gpt4 book ai didi

javascript - 如何修复此 httpProvider 错误?

转载 作者:行者123 更新时间:2023-11-27 23:15:37 25 4
gpt4 key购买 nike

.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] Unknown provider: $httpProvider <- $http <- search " occurs.

有人能找到解决这个问题的方法吗?

最佳答案

如果您只需要一个简单的解决方案,请将喷油器部分修改为

  angular.injector(['mvpass.services','ng'])

一定会成功的

关于javascript - 如何修复此 httpProvider 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35858192/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com