[英]Angular Error: [$injector:unpr] while adding ui.bootstrap
I've built simple angular page but after addition of ui.bootstrap to the dependencies I got an error: 我已经构建了简单的角度页面,但是在将ui.bootstrap添加到依赖项之后,出现了一个错误:
Error: [$injector:unpr] http://errors.angularjs.org/1.4.8/$injector/unpr?p0=%24modalProvider%20%3C-%20%24modal%20%3C-%20HomeController
Here is reference part of the index.html file: 这是index.html文件的参考部分:
<link href="Content/bootstrap.min.css" rel="stylesheet" />
<script src="Scripts/angular.min.js"></script>
<script src="Scripts/angular-route.min.js"></script>
<script src="Scripts/angular-ui/ui-bootstrap-tpls.min.js"></script>
<script src="app/AngularFormsApp.js"></script>
<script src="app/EmployeeForm/efController.js"></script>
<script src="app/EmployeeForm/efDirective.js"></script>
<script src="app/DataService.js"></script>
and this is my application js: 这是我的应用程序js:
var angularFormsApp = angular.module('angularFormsApp',['ngRoute','ui.bootstrap']);
angularFormsApp.config(function($routeProvider) {
$routeProvider
.when("/home", {
templateUrl: "app/Home.html",
controller: "HomeController"
}).when("/newEmployeeForm", {
templateUrl: "app/EmployeeForm/efTemplate.html",
controller: "efController"
}).when("/updateEmployeeForm/:id", {
templateUrl: "app/EmployeeForm/efTemplate.html",
controller: "efController"
}).otherwise({
redirectTo:"/home"
});
});
angularFormsApp.controller("HomeController",
function ($scope, $location, $modal,DataService) {
$scope.showCreateEmployeeForm = function () {
$location.path('/newEmployeeForm');
$modal.open(
{
templateUrl: 'app/EmployeeForm/efTemplate.html',
controller: 'efController'
});
};
$scope.showUpdateEmployeeForm = function (id) {
$location.path('/updateEmployeeForm/'+id);
};
});
Any ideas what did I wrong? 有什么想法我错了吗? Whitout ui.bootstrap reference the page runs well.
Whitout ui.bootstrap参考页面运行良好。
More recent versions changed $modal
to $uibModal
. 最新版本将
$modal
更改$modal
$uibModal
。
Same ui
prefix was added to a number of the services. 相同的
ui
前缀已添加到许多服务中。 See docs examples 查看文件范例
To utilize the full power of UIB include the ng-animate script and inject it into your module. 要利用UIB的全部功能,请包括ng-animate脚本并将其注入模块中。 This will add animation to your modal.
这会将动画添加到您的模态中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.