AngularJS - Material - Multiple Dialogs

HTML
<!DOCTYPE html> <div ng-controller="AppCtrl as ctrl" ng-cloak ng-app="MyApp" > <md-content layout="column"> <md-button ng-click="ctrl.moreInfo(1)"> Open Dialog </md-button> </md-content> </div>
CSS
.md-dialog-backdrop:nth-of-type(even) { z-index: 81; } .md-dialog-backdrop:nth-of-type(odd) { z-index: 79; } .md-dialog-container:nth-of-type(even) { z-index: 80; } .md-dialog-container:nth-of-type(odd) { z-index: 82; } .stickyDialog { min-height: 200px; }
JAVASCRIPT
(function () { 'use strict'; angular .module('MyApp', ['ngMaterial']) .controller('AppCtrl', function($mdDialog) { var vm = this; vm.moreInfo = function moreInfo(thing) { $mdDialog.show({ controllerAs: 'dialogCtrl', clickOutsideToClose: true, bindToController: true, controller: function($mdDialog) { this.click = function() { $mdDialog.show({ controllerAs: 'dialogCtrl', controller: function($mdDialog) { this.click = function() { $mdDialog.hide(); }; }, preserveScope: true, autoWrap: true, skipHide: true, // this line does the trick template: '<md-dialog class="confirm"><md-conent><md-button ng-click="dialogCtrl.click()">I am in a 2nd dialog!</md-button></md-conent></md-dialog>' }); }; }, autoWrap: false, template: '<md-dialog class="stickyDialog" data-type="{{::dialogCtrl.thing.title}}"><md-conent><md-button ng-click="dialogCtrl.click()">I am in a dialog!</md-button></md-conent></md-dialog>', locals: { thing: thing } }); }; }); })();
Expand for more options Login