我正在使用http://angular-ui.github.io/bootstrap/(版本.10)。 我需要在事件点击完整日历(http://arshaw.com/fullcalendar/)时打开一个简单的模态窗口。
我是用
做的 select: function (start, end, allDay) {
console.log('Calendar select event fired');
var modalInstance = $modal.open({
templateUrl: 'template.html',
controller: function ($scope, $modalInstance) {
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
},
});
这是第一次工作,模态打开和关闭确定。 但是在第二次点击时,模态不会打开。 $ modal.open被触发,控制台显示没有错误。
如果使用ng-click完成相同的练习,则始终有效。在控制器中写入打开功能后也需要这样做。
<button class="btn btn-default" ng-click="open()">Open me!</button>
但是我的目标是使用$ modal.open从另一个指令调用模态。
我错过了什么?
感谢您的帮助。
答案 0 :(得分:0)
尝试创建控制器功能,例如
controller : 'sampleCtrl'
然后执行:
var sampleCtrl=function(){}
在此功能中实现您的功能,这将解决您的问题。