我有一个按钮directive
应该打开一个配置ngDialog
。
这是我的theme.html
指令代码:
<div class="col-lg-3 col-md-6">
<div class="panel panel-{{colour}}">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-{{type}} fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<div class="huge">{{name}}</div>
<div>{{comments}}</div>
</div>
</div>
</div>
<div class="panel-footer">
<div class="ngdialog-buttons btn-toolbar">
<button type="button" ng-dialog-controller="MainCtrl" class="ngdialog-button btn btn-primary pull-right" ng-click="openConfigWindow('theme')">Settings</button>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
theme.js
angular.module('adminApp')
.directive('theme',function() {
return {
templateUrl:'scripts/directives/theme/theme.html',
restrict:'E',
replace:true,
scope: {
'model': '=',
'comments': '@',
'name': '@',
'colour': '@',
'details':'@',
'type':'@',
'goto':'@',
'status':'@'
/*hooking this event invokes the ngClick, but not on the button*/
//eventHandler: '&ngClick'
}
}
});
以下是theme
指令的使用方式html
:
<div class="panel-body" data-ng-controller="MainCtrl">
<theme name="test" comments="New comments!" colour="info" type="sample" status="Deactivate"></theme>
</div>
main.js
包含MainCtrl
控制器:
angular.module('adminApp')
.controller('MainCtrl', function($scope,$position,$rootScope, ngDialog) {
$scope.openConfigWindow = function (themeName) {
$rootScope.theme = themeName;
ngDialog.open({
template: '/views/configPopup.html',
controller: 'InsideCtrl',
className: 'ngdialog-theme-default dialogDimension',
closeByDocument: false
});
};
})
openConfigWindow
没有被调用,我应该如何绑定ng-click
到我的主题指令中的按钮?