how to write css for a specific breakpoint in angular material

前端 未结 2 1362
温柔的废话
温柔的废话 2021-02-04 05:23

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

2条回答
  •  無奈伤痛
    2021-02-04 06:05

    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: 
    
    ...

提交回复
热议问题