【发布时间】:2016-01-25 18:32:36
【问题描述】:
当我尝试使用 $http 从我的应用程序上的 API 获取值时遇到注入错误。我包括模块定义的代码和调用 Web API 的函数以及浏览器控制台中的错误。
angular.module('mod-1').controller('Controller', ['$scope','http', 'APICM', '$q', '$filter', '$timeout', 'AppSettings'$modal', 'Dialog', 'title',
function ($scope, $http, API, $q, $filter, $timeout, AppSettings, $modal, Dialog, title) {
$('.page-title').text(title);
function getActiveStore() {
$http.get("https://localhost:44300/api/store/active").success(
function (response) {
$scope.currentStore = response;
})
}
}
错误: 错误:[$injector:unpr]http://errors.angularjs.org/undefined/$injector/unpr?p0=httpProvider%20%3C-%20http 在错误(本机) 在https://localhost:44300/Scripts/vendor/angular.min.js:6:453 在https://localhost:44300/Scripts/vendor/angular.min.js:32:18 在 Object.c [as get] (https://localhost:44300/Scripts/vendor/angular.min.js:29:147) 在https://localhost:44300/Scripts/vendor/angular.min.js:32:86 在 c (https://localhost:44300/Scripts/vendor/angular.min.js:29:147) 在 d (https://localhost:44300/Scripts/vendor/angular.min.js:29:324) 在 Object.instantiate (https://localhost:44300/Scripts/vendor/angular.min.js:30:482) 在https://localhost:44300/Scripts/vendor/angular.min.js:59:495 在https://localhost:44300/Scripts/vendor/angular-route.min.js:6:446
【问题讨论】: