Skip to content

Commit

Permalink
docs(dialog): remove invalid, outdated example code
Browse files Browse the repository at this point in the history
- minor refinements to $mdDialog example formatting

Closes angular#10562
  • Loading branch information
Splaktar committed Oct 26, 2020
1 parent d77fbc4 commit ff34149
Showing 1 changed file with 23 additions and 31 deletions.
54 changes: 23 additions & 31 deletions src/components/dialog/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,9 @@ function MdDialogDirective($$rAF, $mdTheming, $mdDialog) {
* </hljs>
*
* ### JavaScript: promise API syntax, custom dialog template
*
* <hljs lang="js">
* (function(angular, undefined){
* (function(angular, undefined) {
* "use strict";
*
* angular
Expand All @@ -297,7 +298,6 @@ function MdDialogDirective($$rAF, $mdTheming, $mdDialog) {
* var ctrl = this;
*
* ctrl.showAlert = showAlert;
* ctrl.closeAlert = closeAlert;
* ctrl.showGreeting = showCustomGreeting;
*
* ctrl.hasAlert = function() { return !!alert };
Expand All @@ -312,44 +312,36 @@ function MdDialogDirective($$rAF, $mdTheming, $mdDialog) {
* .ok('Close');
*
* $mdDialog
* .show( alert )
* .show(alert)
* .finally(function() {
* alert = undefined;
* });
* }
*
* // Close the specified dialog instance and resolve with 'finished' flag
* // Normally this is not needed, just use '$mdDialog.hide()' to close
* // the most recent dialog popup.
* function closeAlert() {
* $mdDialog.hide( alert, "finished" );
* alert = undefined;
* }
*
* // Dialog #2 - Demonstrate more complex dialogs construction and popup.
*
* function showCustomGreeting($event) {
* $mdDialog.show({
* targetEvent: $event,
* template:
* '<md-dialog>' +
* ' <md-dialog-content>Hello {{ ctrl.employee }}!</md-dialog-content>' +
* ' <md-dialog-actions>' +
* ' <md-button ng-click="ctrl.closeDialog()" class="md-primary">' +
* ' Close Greeting' +
* ' </md-button>' +
* ' </md-dialog-actions>' +
* '</md-dialog>',
* controller: GreetingController,
* controllerAs: 'ctrl',
* onComplete: afterShowAnimation,
* locals: { employee: ctrl.userName }
* });
* $mdDialog.show({
* targetEvent: $event,
* template:
* '<md-dialog>' +
* ' <md-dialog-content>Hello {{ ctrl.employee }}!</md-dialog-content>' +
* ' <md-dialog-actions>' +
* ' <md-button ng-click="ctrl.closeDialog()" class="md-primary">' +
* ' Close Greeting' +
* ' </md-button>' +
* ' </md-dialog-actions>' +
* '</md-dialog>',
* controller: GreetingController,
* controllerAs: 'ctrl',
* onComplete: afterShowAnimation,
* locals: { employee: ctrl.userName }
* });
*
* // When the 'enter' animation finishes...
* function afterShowAnimation(scope, element, options) {
* // post-show code here: DOM element focus, etc.
* }
* // When the 'enter' animation finishes...
* function afterShowAnimation(scope, element, options) {
* // post-show code here: DOM element focus, etc.
* }
* }
* }
*
Expand Down

0 comments on commit ff34149

Please sign in to comment.