angularjs - 使用 $mdDialog.confirm() 关闭父页面

标签 angularjs

I have open a template by using $mdDialog.show() like this:-

 $mdDialog.show({
skipHide: true,
 controller: 'EditController',
templateUrl: 'app/View/Edit.html',
parent: angular.element(document.body),
clickOutsideToClose: false
});

Now I am tring to show the alert before saving the data by using the $mdDialog.confirm() like this:-

  var confirm = $mdDialog.confirm()                                                 .parent(angular.element(document.body))
    .content('Are you sure to save the document? ')
    .ok('Save')
    .cancel('Cancel')
$mdDialog.show(confirm).then(function () {}
    ,function () { $mdDialog.hide();
        });

Issue : Closing the opened template after opening the alert.

最佳答案

可以同时打开多个对话:

Using the multiple option for the $mdDialog service allows developers to show multiple dialogs at the same time.

示例:

// From plain options
$mdDialog.show({
      multiple: true
});

// From a dialog preset
$mdDialog.show(
      $mdDialog
     .confirm()
     .multiple(true)
);

这是 Reference为此。

关于angularjs - 使用 $mdDialog.confirm() 关闭父页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40583085/

相关文章:

html - 强制浏览器加载最后一个 angularjs 应用程序代码

angularjs - 带有 Angular 前端的 SignalR 可在本地主机上工作,但无法远程工作

css - AngularJS - 无法删除单击时添加的添加的 css 类

javascript - Angular Js 指令通信检测范围内是否有另一个指令

javascript - 将多维 JSON 键值对转换为 Angular 菜单(无需 Angular 知识)

angularjs - 使用 AngularJS 将字符串数据发布到 Web API 结果为 null

javascript - AngularJS:使用基于选择的过滤器后,如果仅限于单个属性,则不会清除

javascript - 如何解析 Angular 中的嵌套转发器?

javascript - Angular js搜索使用过滤器关键字显示按标题分组的数组项

javascript - angularjs selft $broadcast 和 $on