角度材料从模板指令关闭mdDialog

Har*_*bel 5 angularjs angularjs-directive angular-material

我想以这种方式关闭对话:

showAlert(ev) {
    this.mdDialog.show({
      restrict: 'E',
      template:'<loader></loader>' +
      '    <md-button ng-click="this.mdDialog.hide()" class="md-primary">' +
    '      Close Dialog' +
    '    </md-button>' ,
      parent: angular.element(document.body.childNodes[5]),
      clickOutsideToClose:true
  });
};
closeDialog() {
  this.mdDialog.hide();
};
Run Code Online (Sandbox Code Playgroud)

但按钮出现,什么都不做.任何的想法 ?

Har*_*bel 2

我在那里找到了答案 http://webiks.com/mddialog-with-a-confirmation-dialog/

在页面https://embed.plnkr.co/HiLJlsp0yfcukxi2McNZ/的最后一个插件中。

不需要范围属性。

聚苯乙烯

现在我在版本后看到@camden_kid 的答案,对我来说也是正确的,谢谢。