123

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div ng-controller="AppCtrl" layout="column" layout-margin="" class="dialogdemoBasicUsage" ng-app="MyApp">
  
  
    <div>
      <md-button class="md-primary" ng-click="showAdvanced($event)">
        Custom Dialog
      </md-button>
    </div>
 <div>
      <md-button class="md-primary" ng-click="showAdvanced($event)">
        Some other button you can try and click even when the popup is on
      </md-button>
    </div>
  
  <br>
  <b layout="row" layout-align="center center" layout-margin="">
    {{alert}}
  </b>
<script type="text/ng-template" id="dialog1.tmpl.html"><md-dialog aria-label="Mango (Fruit)">
  <form>
  <md-dialog-content class="sticky-container">
    <md-subheader class="md-sticky-no-effect">Mango (Fruit)</md-subheader>
    <div>
      <p>
        The mango is a juicy stone fruit belonging to the genus Mangifera, consisting of numerous tropical fruiting trees, cultivated mostly for edible fruit. The majority of these species are found in nature as wild mangoes. They all belong to the flowering plant family Anacardiaceae. The mango is native to South and Southeast Asia, from where it has been distributed worldwide to become one of the most cultivated fruits in the tropics.
      </p>

      <img style="margin: auto; max-width: 100%;" alt="Lush mango tree" src="https://material.angularjs.org/img/mangues.jpg">

      <p>
        The highest concentration of Mangifera genus is in the western part of Malesia (Sumatra, Java and Borneo) and in Burma and India. While other Mangifera species (e.g. horse mango, M. foetida) are also grown on a more localized basis, Mangifera indica&mdash;the "common mango" or "Indian mango"&mdash;is the only mango tree commonly cultivated in many tropical and subtropical regions.
      </p>
      <p>
        It originated in Indian subcontinent (present day India and Pakistan) and Burma. It is the national fruit of India, Pakistan, and the Philippines, and the national tree of Bangladesh. In several cultures, its fruit and leaves are ritually used as floral decorations at weddings, public celebrations, and religious ceremonies.
      </p>
    </div>
  </md-dialog-content>

  <div class="md-actions" layout="row">
    <md-button href="http://en.wikipedia.org/wiki/Mango" target="_blank" hide show-md>
      More on Wikipedia
    </md-button>
    <span flex></span>
    <md-button ng-click="answer('not useful')" class="md-primary">
     Not Useful
    </md-button>
    <md-button ng-click="answer('useful')" class="md-primary">
      Useful
    </md-button>
  </div>
  </form>
</md-dialog>
</script></div>
            
          
!
            
              .dialogdemoBasicUsage .dialogDemo1 {
  height: 500px; }
.dialogdemoBasicUsage .dialog-demo-content div {
  text-align: center; }
.dialogdemoBasicUsage .md-subheader {
  background-color: #dcedc8;
  margin: 0; }
.md-dialog-container{
    pointer-events: none;
}

md-dialog{
    pointer-events: all;
}

            
          
!
            
              angular.module('MyApp')

.controller('AppCtrl', function($scope, $mdDialog) {
  $scope.alert = '';
	$scope.userName = 'Johnny';
  $scope.showAdvanced = function($event) {
    $mdDialog.show({
      hasBackdrop: false,
      targetEvent: $event,
    	template: '<md-dialog>' +
                '  <md-dialog-content>Hello {{ employee }}!</md-dialog-content>' +
                '  <div class="md-actions">' +
                '    <md-button ng-click="closeDialog()" class="md-primary">' +
                '      Close Greeting' +
                '    </md-button>' +
                '  </div>' +
                '</md-dialog>',
    	controller: function($scope, $mdDialog, employee){
         $scope.employee = employee;
         $scope.closeDialog = function(){$mdDialog.hide();};
        
        $scope.hide = function() {
          $mdDialog.hide();
        };
        $scope.cancel = function() {
          $mdDialog.cancel();
        };
        $scope.answer = function(answer) {
          $mdDialog.hide(answer);
        };
      },
    	locals: {employee: $scope.userName}
    });
  };
});

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console