【问题标题】:i am getting Error: $injector:unpr Unknown Provider when i add the ui.bootstrap添加 ui.bootstrap 时出现错误:$injector:unpr Unknown Provider
【发布时间】: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


【解决方案1】:

您需要确保在 index.html 中添加了指向角度引导文件的链接。例如

 <script src="bower_components/angular-bootstrap/ui-bootstrap.js"></script>
 <script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>

【讨论】:

  • 是的,我已经做到了。我认为我的角度代码有问题,我无法弄清楚。
猜你喜欢
  • 1970-01-01
  • 2016-11-12
  • 1970-01-01
  • 1970-01-01
  • 2015-08-26
  • 2016-09-27
  • 1970-01-01
  • 1970-01-01
  • 2017-06-02
相关资源
最近更新 更多