I am trying to write CSS for a div, that should apply only when a particular breakpoint is hit, eg. sm, md or lg.
I'm using angular-material (https://material.angularjs.org).
I know that this can be done using media queries @media (max-width: 480px) { ... }
but i'm looking for a angular-material way of doing this.
I'm using the $mdMedia service for that, see:
https://material.angularjs.org/latest/#/api/material.core/service/$mdMedia
Additionally you can use it in a template directly e.g. with an ng-class directive:
// In your controller:
$scope.$mdMedia = $mdMedia;
// In your template:
<div ng-class="{sm: $mdMedia('sm'), md: $mdMedia('md'), lg: $mdMedia('lg')}">...</div >