【发布时间】:2013-11-30 19:06:34
【问题描述】:
我正在集成来自 Angular Bootstrap 的模态,并尝试将 here 中的代码示例调整到我的应用程序中。我收到错误:Error: [$injector:unpr] Unknown provider: $modalInstanceProvider <- $modalInstance
我需要做什么才能使 $modalInstance 工作?我从代码示例中看到他们已经编写了它,因此它在函数的范围内,但我不确定在链接控制器时如何编写。
angular.module('myApp', ['ui.bootstrap']).
controller('ModalInstanceCtrl', function($scope, $modalInstance) {
}).
factory('AuthService', ['$http', '$rootScope', '$modal',
function($http, $rootScope, $modal) {
return {
loginModal: function(callback) {
var modalInstance = $modal.open({
templateUrl: '/partials/main/signin',
controller: 'ModalInstanceCtrl'
});
modalInstance.result.then(function(selectedItem) {
$scope.selected = selectedItem;
}, function() {});
}
};
}
]);
【问题讨论】:
标签: javascript angularjs angular-ui-bootstrap