API Reference

$mdMedia is used to evaluate whether a given media query is true or false given the current device's screen / window size. The media query will be re-evaluated on resize, allowing you to register a watch.

$mdMedia also has pre-programmed support for media queries that match the layout breakpoints. (sm, gt-sm, md, gt-md, lg, gt-lg).

Usage

app.controller('MyController', function($mdMedia, $scope) { $scope.$watch(function() { return $mdMedia('lg'); }, function(big) { $scope.bigScreen = big; }); $scope.screenIsSmall = $mdMedia('sm'); $scope.customQuery = $mdMedia('(min-width: 1234px)'); $scope.anotherCustom = $mdMedia('max-width: 300px'); });
Returns Description
boolean

a boolean representing whether or not the given media query is true or false.