nav*_*een 5 angularjs angular-ui-bootstrap
我试图像使用angularui-bootstrap一样调用模态.
var authApp = angular.module('AuthApp', ['ui.bootstrap']);
authApp.controller('AuthController',
['$scope', '$uibModal',
function ($scope, $uibModal) {
//$scope.credentials = {
// userName: "",
// uPassword: "",
// rememberMe: ""
//};
$scope.OpenLoginModal = function (templateUrl) {
var modalInstance = $uibModal.open({
animation: false,
backdrop: 'static',
templateUrl: templateUrl,
controller: 'loginModalController'//,
//resolve: {
// credentials: function () {
// return $scope.credentials;
// }
//}
});
};
}]);
authApp.controller('loginModalController',
['$scope', '$modalInstance', 'AuthService',
function ($scope, $modalInstance, AuthService) {
//$scope.credentials = credentials;
//$scope.headerTitle = 'Login Information';
$scope.LoginUser = function () {
//var data = {};
//console.log($scope.credentials);
AuthService.ValidateServerAccessDetails(data).then(function (response) {
//$modalInstance.close(response.data);
}, function (response) {
//$scope.userName = "";
//$scope.passWord = "";
});
};
$scope.CancelLogin = function () {
$modalInstance.dismiss('cancel');
};
}]);
Run Code Online (Sandbox Code Playgroud)
我收到这个错误,
错误:[$ injector:unpr]未知提供者:$ modalInstanceProvider < - $ modalInstance < - loginModalController
我在Plunker中也遇到了同样的错误:https://plnkr.co/edit/3rmapgrLhYJ3plyPWm87
我究竟做错了什么?使用的版本是angularjs-1.4.7和angularui-1.1.2
PS:我在这里查了很多答案.其中一个问题就是这个问题.Angularjs模式中的未知提供者:$ modalInstanceProvider < - $ modalInstance
det*_*lor 19
尝试将依赖项更改$uibModalInstance
为文档中的示例中使用的依赖项.你的控制器看起来像:
authApp.controller('loginModalController', [
'$scope', '$uibModalInstance', 'AuthService',
function ($scope, $uibModalInstance, AuthService) {
// implementation
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
9745 次 |
最近记录: |