【发布时间】:2015-07-14 12:20:25
【问题描述】:
我正在尝试使用角度引导模块。我收到此错误
错误:$injector:unpr 未知提供者
当我添加 ui.bootstrap 时。
我看过很多例子,但我无法弄清楚。
谢谢
这是我的工厂
(function () {
'use strict';
var app = angular.module('Candidate', ['ui.bootstrap']);
var serviceId = 'conferenceFactory';
app.factory(serviceId, ['$http', conferenceFactory]);
function conferenceFactory($http) {
var service = {
getCandidate: getCandidate,
};
return service;
function getCandidate() {
return $http.get('/api/getcandidate/get');
}
}
})();
这是我的控制器代码
(function () {
'use strict';
var controllerId = 'conferenceController';
angular.module('Candidate', ['ui.bootstrap']).controller(controllerId,
['$scope', 'conferenceFactory', '$modalInstance',
function ($scope, conferenceFactory, $modalInstance) {
getdata();
function getdata() {
$scope.candidates = [];
conferenceFactory.getCandidate().success(function (data) {
$scope.candidates = data;
}).error(function (data) {
});
}
$scope.showCandidate = function (data) {
var params = {
candidate: data,
};
};
}
]);
})();
【问题讨论】:
-
您是否记得在您的 index.html 文件中添加指向 angularbootstrap js 文件的链接?
标签: angularjs twitter-bootstrap