Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Remove $mdMedia references from mdDialog example #9032

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/components/dialog/demoBasicUsage/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
</md-button>
</div>
<p class="footer">Note: The <b>Confirm</b> dialog does not use <code>$mdDialog.clickOutsideToClose(true)</code>.</p>
<div hide-gt-sm layout="row" layout-align="center center" flex>
<md-checkbox ng-model="customFullscreen" aria-label="Fullscreen Custom Dialog">Force Custom Dialog Fullscreen</md-checkbox>
</div>

<div ng-if="status" id="status">
<b layout="row" layout-align="center center" class="md-padding">
Expand All @@ -38,6 +35,8 @@
<div class="dialog-demo-prerendered">
<md-checkbox ng-model="listPrerenderedButton">Show Pre-Rendered Dialog</md-checkbox>
<p class="md-caption">Sometimes you may not want to compile the dialogs template on each opening.</p>
<md-checkbox ng-model="customFullscreen" aria-label="Fullscreen custom dialog">Use full screen mode for custom dialog</md-checkbox>
<p class="md-caption">Allows the dialog to consume all available space on small devices</p>
</div>


Expand Down
17 changes: 3 additions & 14 deletions src/components/dialog/demoBasicUsage/script.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
angular.module('dialogDemo1', ['ngMaterial'])

.controller('AppCtrl', function($scope, $mdDialog, $mdMedia) {
.controller('AppCtrl', function($scope, $mdDialog) {
$scope.status = ' ';
$scope.customFullscreen = $mdMedia('xs') || $mdMedia('sm');
$scope.customFullscreen = false;

$scope.showAlert = function(ev) {
// Appending dialog to document.body to cover sidenav in docs app
Expand Down Expand Up @@ -57,30 +57,19 @@ angular.module('dialogDemo1', ['ngMaterial'])
};

$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,
fullscreen: useFullScreen
fullscreen: $scope.customFullscreen // Only for -xs, -sm breakpoints.
})
.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);
});

};

$scope.showTabDialog = function(ev) {
Expand Down