A Pen by Captain Anonymous on CodePen.
Created
February 9, 2016 18:40
-
-
Save anonymous/05a83442c2e2910fb42b to your computer and use it in GitHub Desktop.
Basic Usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div ng-controller="AppCtrl" class="md-padding dialogdemoBasicUsage" id="popupContainer" ng-cloak="" ng-app="MyApp"> | |
<p class="inset"> | |
xxx | |
</p> | |
<div class="dialog-demo-content" layout="row" layout-wrap="" layout-margin=""> | |
<md-button class="md-primary md-raised" ng-click="showAdvanced($event)" flex="100" flex-gt-md="auto"> | |
Custom Dialog | |
</md-button> | |
</div> | |
<script type="text/ng-template" id="dialog1.tmpl.html"> | |
<md-dialog aria-label="Mango (Fruit)" ng-cloak> | |
<form> | |
<md-toolbar> | |
<div class="md-toolbar-tools"> | |
<h2>Mango (Fruit)</h2> | |
<span flex></span> | |
<md-button class="md-icon-button" ng-click="cancel()"> | |
<md-icon md-svg-src="img/icons/ic_close_24px.svg" aria-label="Close dialog"></md-icon> | |
</md-button> | |
</div> | |
</md-toolbar> | |
<md-dialog-content> | |
<div> | |
bla bla | |
</div> | |
</md-dialog-content> | |
<md-dialog-actions layout="row"> | |
<md-button href="http://en.wikipedia.org/wiki/Mango" target="_blank" md-autofocus> | |
More on Wikipedia | |
</md-button> | |
<span flex></span> | |
<md-button ng-click="answer('not useful')"> | |
Not Useful | |
</md-button> | |
<md-button ng-click="answer('useful')" style="margin-right:20px;"> | |
Useful | |
</md-button> | |
</md-dialog-actions> | |
</form> | |
</md-dialog> | |
</script> | |
</div> | |
<!-- | |
Copyright 2016 Google Inc. All Rights Reserved. | |
Use of this source code is governed by an MIT-style license that can be in foundin the LICENSE file at http://material.angularjs.org/license. | |
--> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('MyApp',['ngMaterial', 'ngMessages', 'material.svgAssetsCache']) | |
.controller('AppCtrl', function($scope, $mdDialog, $mdMedia) { | |
$scope.status = ' '; | |
$scope.customFullscreen = $mdMedia('xs') || $mdMedia('sm'); | |
$scope.showAdvanced = function(ev) { | |
var useFullScreen = ($mdMedia('sm') || $mdMedia('xs')) && $scope.customFullscreen; | |
$mdDialog.show({ | |
controller: DialogController, | |
templateUrl: 'dialog1.tmpl.html', | |
parent: angular.element(document.body), | |
targetEvent: ev, | |
clickOutsideToClose:true, | |
}) | |
.then(function(answer) { | |
$scope.status = 'You said the information was "' + answer + '".'; | |
}, function() { | |
$scope.status = 'You cancelled the dialog.'; | |
}); | |
$scope.$watch(function() { | |
return $mdMedia('xs') || $mdMedia('sm'); | |
}, function(wantsFullScreen) { | |
$scope.customFullscreen = (wantsFullScreen === true); | |
}); | |
}; | |
}); | |
function DialogController($scope, $mdDialog) { | |
$scope.hide = function() { | |
$mdDialog.hide(); | |
}; | |
$scope.cancel = function() { | |
$mdDialog.cancel(); | |
}; | |
$scope.answer = function(answer) { | |
$mdDialog.hide(answer); | |
}; | |
} | |
/** | |
Copyright 2016 Google Inc. All Rights Reserved. | |
Use of this source code is governed by an MIT-style license that can be in foundin the LICENSE file at http://material.angularjs.org/license. | |
**/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.min.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-route.min.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-aria.min.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-messages.min.js"></script> | |
<script src="http://ngmaterial.assets.s3.amazonaws.com/svg-assets-cache.js"></script> | |
<script src="https://cdn.gitcdn.xyz/cdn/angular/bower-material/v1.0.5/angular-material.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.dialogdemoBasicUsage #popupContainer { | |
position: relative; | |
} | |
.dialogdemoBasicUsage .footer { | |
width: 100%; | |
text-align: center; | |
margin-left: 20px; | |
} | |
.dialogdemoBasicUsage .footer, | |
.dialogdemoBasicUsage .footer > code { | |
font-size: 0.8em; | |
margin-top: 50px; | |
} | |
/* | |
Copyright 2016 Google Inc. All Rights Reserved. | |
Use of this source code is governed by an MIT-style license that can be in foundin the LICENSE file at http://material.angularjs.org/license. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="https://cdn.gitcdn.xyz/cdn/angular/bower-material/v1.0.5/angular-material.css" rel="stylesheet" /> | |
<link href="https://material.angularjs.org/1.0.5/docs.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment