我该如何解决这个httpProvider错误?
.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函数被调用时,错误“Uncaught Error:
[$ injector:unpr]未知提供者:$ httpProvider < - $ http < - search“发生。
有没有人看到这种方式可以修复?
如果你只需要一个简单的解决方案,修改注射器部分
angular.injector(['mvpass.services','ng'])
将使其工作
链接地址: http://www.djcxy.com/p/77647.html