works for the first time with $ mdDialog. I use to create a dialog with an external HTML template.
So far, so good ... it works, the template can be opened, but the ng-click in html will no longer work.
And I can not find the reason for this.
mdDialog is called in userController as follows:
<md-icon layout="row" flex md-font-set="material-icons" class="active" ng-click="vm.showMenu($event)"> menu </md-icon>
Method to open $ mdDialog in userController:
vm.showMenu = function showMenu(ev){ $mdDialog.show({ controller: MenuDialogController, templateUrl: 'app/components/head/user/menu.dialog.html', parent: angular.element($document.body), targetEvent: ev, clickOutsideToClose:true, fullscreen: $scope.customFullscreen // Only for -xs, -sm breakpoints. }) .then(function(answer) { $scope.status = 'You said the information was "' + answer + '".'; }, function() { $scope.status = 'You cancelled the dialog.'; }); };
And this is the dialog controller for the dialog in which the buttons do not work:
angular .module('trax') .controller('MenuDialogController', MenuDialogController); function MenuDialogController() { var vm = this; vm.close = function close(){ alert('close clicked'); } vm.ok = function ok(){ alert('ok clicked'); } }
And this is the html code for dialogController:
<md-dialog aria-label="User Menu"> <form ng-cloak> <md-toolbar> <div class="md-toolbar-tools"> <h2>User Menu</h2> <span flex></span> <md-button class="md-icon-button" ng-click="vm.close($event)"> <md-icon md-font-set="material-icons">close</md-icon> </md-button> </div> </md-toolbar> <md-dialog-content> <div class="md-dialog-content"> <h2>Dialog Title</h2> <p>Dialog Text....</p> <p ng-click="vm.test($event)">test</p> </div> </md-dialog-content> <md-dialog-actions layout="row"> <md-button href="http://en.wikipedia.org/wiki/Mango" target="_blank" md-autofocus> More on Wikipedia </md-button> <span flex></span> <md-button ng-click="vm.close($event)"> cancel </md-button> <md-button ng-click="vm.ok($event)"> ok </md-button> </md-dialog-actions> </form> </md-dialog>
None of the ng clicks work!
Any hint for me?