src/components/dialog/dialog.js
function MdDialogController($mdDialog, $mdConstant) {
    // For compatibility with AngularJS 1.6+, we should always use the $onInit hook in
    // interimElements. The $mdCompiler simulates the $onInit hook for all versions.
    this.$onInit = function() {
      var isPrompt = this.$type == 'prompt';

      if (isPrompt && this.initialValue) {
        this.result = this.initialValue;
      }

      this.hide = function() {
        $mdDialog.hide(isPrompt ? this.result : true);
      };
      this.abort = function() {
        $mdDialog.cancel();
      };
      this.keypress = function($event) {
        var invalidPrompt = isPrompt && this.required && !angular.isDefined(this.result);

        if ($event.keyCode === $mdConstant.KEY_CODE.ENTER && !invalidPrompt) {
          $mdDialog.hide(this.result);
        }
      };
    };
  }
function MdDialogController($mdDialog, $mdConstant) {
    // For compatibility with AngularJS 1.6+, we should always use the $onInit hook in
    // interimElements. The $mdCompiler simulates the $onInit hook for all versions.
    this.$onInit = function() {
      var isPrompt = this.$type == 'prompt';

      if (isPrompt && this.initialValue) {
        this.result = this.initialValue;
      }

      this.hide = function() {
        $mdDialog.hide(isPrompt ? this.result : true);
      };
      this.abort = function() {
        $mdDialog.cancel();
      };
      this.keypress = function($event) {
        var invalidPrompt = isPrompt && this.required && !angular.isDefined(this.result);

        if ($event.keyCode === $mdConstant.KEY_CODE.ENTER && !invalidPrompt) {
          $mdDialog.hide(this.result);
        }
      };
    };
  }
function MdDialogController ( $mdDialog , $mdConstant ) { // For compatibility with AngularJS 1.6+, we should always use the $onInit hook in // interimElements. The $mdCompiler simulates the $onInit hook for all versions. this . $onInit = function ( ) { var isPrompt = this . $type == 'prompt' ; if ( isPrompt && this . initialValue ) { this . result = this . initialValue ; } this . hide = function ( ) { $mdDialog . hide ( isPrompt ? this . result : true ) ; } ; this . abort = function ( ) { $mdDialog . cancel ( ) ; } ; this . keypress = function ( $event ) { var invalidPrompt = isPrompt && this . required && ! angular . isDefined ( this . result ) ; if ( $event . keyCode === $mdConstant . KEY_CODE . ENTER && ! invalidPrompt ) { $mdDialog . hide ( this . result ) ; } } ; } ; }
Controller for the md-dialog interim elements
@ngInject
Controller for the md - dialog interim elements