Angularjs 角度UI引导$uibModal未被注入?
我试图使用angular bootstrap,由于某种原因,我得到了一个未知提供程序错误 一切看起来都井然有序。我已经安装了bower的最新版本,如下面我的bower.json文件所示 这是我的bower.json文件:Angularjs 角度UI引导$uibModal未被注入?,angularjs,angular-ui-bootstrap,Angularjs,Angular Ui Bootstrap,我试图使用angular bootstrap,由于某种原因,我得到了一个未知提供程序错误 一切看起来都井然有序。我已经安装了bower的最新版本,如下面我的bower.json文件所示 这是我的bower.json文件: { "name": "client", "version": "0.0.0", "dependencies": { "angular": "^1.5.8", "bootstrap-sass-official": "^3.2.0", "ang
{
"name": "client",
"version": "0.0.0",
"dependencies": {
"angular": "^1.5.8",
"bootstrap-sass-official": "^3.2.0",
"angular-animate": "^1.4.0",
"angular-cookies": "^1.4.0",
"angular-resource": "^1.4.0",
"angular-route": "^1.4.0",
"angular-sanitize": "^1.4.0",
"angular-touch": "^1.4.0",
"angular-ui-router": "^0.3.1",
"jquery": "^2.2.0",
"angular-xeditable": "^0.2.0",
"oclazyload": "^1.0.9",
"angular-motion": "^0.4.4",
"angular-local-storage": "^0.5.0",
"angular-sweetalert": "latest",
"angular-password": "^1.0.3",
"ng-file-upload-shim": "^12.2.12",
"ng-file-upload": "^12.2.12",
"ng-img-crop": "ngImgCrop#^0.3.2",
"ngvideo": "^1.0.2",
"angular-bootstrap": "^2.2.0"
},
"devDependencies": {
"angular-mocks": "^1.4.0"
},
"appPath": "app",
"moduleName": "clientApp",
"overrides": {
"bootstrap": {
"main": [
"less/bootstrap.less",
"dist/css/bootstrap.css",
"dist/js/bootstrap.js"
]
}
},
"resolutions": {
"angular": "~1.x"
}
}
我已将引用添加到我的模型中:
angular
.module('clientApp', [
'ngAnimate',
'ngCookies',
'ngResource',
'ui.router',
'ngSanitize',
'ngTouch',
'ui.bootstrap',
'oitozero.ngSweetAlert'
])
我把它注入我的控制器:
.controller('BalanceWheelController', function($scope, $uibModal, lessons, $state) {
我调用模态的函数是:
var modalInstance = $uibModal.open({
animation: true,
backdrop: 'static',
keyboard: false,
templateUrl: 'questionsModal.html',
controller: function($scope, $uibModalInstance, SweetAlert) {
$scope.close = function() {
//self.showingExpenses = false;
$uibModalInstance.close();
videoId.play();
};
}
});
所以我真的很困惑,为什么会出现以下错误:
angular.js:10160 Error: [$injector:unpr] Unknown provider: $templateRequestProvider <- $templateRequest <- $uibModal
http://errors.angularjs.org/1.2.32/$injector/unpr?p0=%24templateRequestProvider%20%3C-%20%24templateRequest%20%3C-%20%24uibModal
at http://localhost:9000/bower_components/angular/angular.js:78:12
at http://localhost:9000/bower_components/angular/angular.js:3803:19
at Object.getService [as get] (http://localhost:9000/bower_components/angular/angular.js:3931:39)
at http://localhost:9000/bower_components/angular/angular.js:3808:45
at getService (http://localhost:9000/bower_components/angular/angular.js:3931:39)
at Object.invoke (http://localhost:9000/bower_components/angular/angular.js:3958:13)
at http://localhost:9000/bower_components/angular/angular.js:3809:37
at getService (http://localhost:9000/bower_components/angular/angular.js:3931:39)
at invoke (http://localhost:9000/bower_components/angular/angular.js:3958:13)
at Object.instantiate (http://localhost:9000/bower_components/angular/angular.js:3978:23) <div ui-view="" class="ng-scope">
angular.js:10160错误:[$injector:unpr]未知提供程序:$templateRequestProvider您已成功安装angular 1.2.32(注意错误URL中的版本),该版本没有$templateRequest
提供程序。这是通过一个(或多个)依赖项实现的
更改分辨率
以匹配角度
依赖项版本
"resolutions": {
"angular": "^1.5.8"
}
在这里,我建议您将所有角度依赖项的版本匹配为完全相同,即角度动画
,角度模拟
,等等。看起来您没有添加ui bootstrap.js的引用?@NikhilVM可能只是错误的.js
文件,因为$uibModal
存在,但$templateRequest
存在not@NikhilVM不知道你的意思。它在'ngTouch',('ui.bootstrap',)'oitozero.ngSweetAlert'@cnak2之间引用,我的意思是在index.htmltanks中添加ui-bootstrap.js,Phil。成功了!谢谢大家的帮助。
"resolutions": {
"angular": "^1.5.8"
}