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);
};
Whenever the searchInput function is called, the error "Uncaught Error:
[$injector:unpr] Unknown provider: $httpProvider <- $http <- search " occurs.
Does anyone see a way this could be fixed?
if u just need a simple solution, modifying the injector part to
angular.injector(['mvpass.services','ng'])
will make it work
链接地址: http://www.djcxy.com/p/77648.html上一篇: angularjs如何知道查找模块?