.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“发生。
有没有人看到这种方法可以解决?
答案 0 :(得分:0)
如果你只需要一个简单的解决方案,将注射器部件修改为
angular.injector(['mvpass.services','ng'])
将使其有效