我试图在另一个模态弹出窗口中打开模态弹出窗口。我收到以下错误
angular.min-1.2.29.js:93错误:[$ injector:unpr] http://errors.angularjs.org/1.2.29/ $注射器/ unpr?P0 =%24modalInstanceNewProvider%20%3 C-%20%24modalInstanceNew 在错误(本机)
以下是我的代码
var OuterController = function($scope, $modalInstance, $timeout, $http, $window, $rootScope, mydetails,$modal) {
$scope.openInnerModal = function(){
var modalInstanceNew = $modal.open({
templateUrl: '../../TEST-ANOTHER.html',
controller: InnerController,
resolve: {
lDetails: function(){
return mydetails;
}
}
});
}
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
}
}
var InnerController = function($scope, $modalInstanceNew,$timeout, $http, $window, $rootScope,lDetails,$modal) {
alert(lDetails);
$scope.cancel = function() {
$modalInstanceNew.dismiss('cancel');
}
}
答案 0 :(得分:1)
错误是$modalInstanceNew
不是已知的提供商。这是完全正确的。它应该是$modalInstance
。
尝试这样的内部模态代码:
var InnerController = function($scope, $modalInstance,$timeout, $http, $window, $rootScope,lDetails,$modal) {
alert(lDetails);
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
}
}