[英]How can I fix this httpProvider Error?
.factory("search", ["$http", function($http) {
var searchResult = {};
return {
searchResults: function(searchQuery){
return $http.post("http://crazybacyn.pythonanywhere.com/search", searchQuery).then(function(response){
//quotes around the param of {param:value} may not be needed, depends on JSON vs JS
if(reponse.response!="success"){
response.matches=["No Results"];
}
searchResult = response.matches;
return searchResult;
});
}
};
}])
searchInput = function(){
var searchBar = {"sid": 0, "query": document.getElementById("inputField").value};
searchStuff = angular.injector(['mvpass.services']).get('search').searchResults(searchBar);
tableCreate(searchStuff);
};
每當調用searchInput函數時,錯誤“未捕獲的錯誤:
[$ injector:unpr]未知提供程序:發生$ httpProvider <-$ http <-search“。
有誰看到可以解決此問題的方法?
如果您只需要一個簡單的解決方案,請將噴油器零件修改為
angular.injector(['mvpass.services','ng'])
將使其工作
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.