我试图创建一个弹出的简单模态,并提供不同的菜单选项.它应该很简单,我在ui bootstrap网站上跟随Plunker进行模态但是我收到一条错误,说$ uibModal是一个未知的提供者.这是角度代码:
angular.module('billingModule', ['ngAnimate', 'ui.bootstrap']);
angular.module('billingModule').controller('StoreBillingCtrl', function ($scope, $uibModal) {
$scope.openStoreBilling = function () {
var modalInstance = $uibModal.open({
animation: true,
templateUrl: 'storeBillingContent.html',
controller: 'ModalInstanceCtrl',
});
};
});
angular.module('billingModule').controller('OfficeBillingCtrl', function ($scope, $uibModal) {
$scope.openOfficeBilling = function () {
var modalInstance = $uibModal.open({
animation: true,
templateUrl: 'officeBillingContent.html',
controller: 'ModalInstanceCtrl',
});
};
});
angular.module('billingModule').controller('ModalInstanceCtrl', function ($scope, $uibModalInstance) {
$scope.close = function () {
$uibModalInstance.dismiss();
}
});
Run Code Online (Sandbox Code Playgroud)
我阅读了错误文档并意识到这是一个依赖性错误.但我只是不知道我哪里出错了.我有角度1.4.8和ui-bootstrap 0.14.3.
以下是我添加的脚本:
<head runat="server">
<title>DP Billing</title>
<link href="../CSS/bootstrap.css" rel="stylesheet" />
<link href="../CSS/base.css" rel="stylesheet" /> …Run Code Online (Sandbox Code Playgroud) $ uibModalInstance是否有任何属性,如.ready或.opened?我试图根据传递给它的数据更改UI Bootstrap模式中的CSS类元素.加载模态后,我需要一种方法来触发函数.我知道$ uibModal具有.opened,.close和.rendered等属性,但这会在创建模态的控制器中触发,而不是在模态控制器本身内.由于所有数据都在模态控制器内,因此我无法从外部控制器访问它.
有什么建议?