Reputation: 53
I'm wondering if there is any way to do gradients using the Angular Material md-colors directive?
https://material.angularjs.org/1.1.1/api/directive/mdColors
Thanks
Upvotes: 3
Views: 3057
Reputation: 12813
It doesn't seem possible with the md-colors
directive but you can do it programatically - CodePen
Markup
<div ng-controller="AppCtrl as ctrl" ng-cloak="" ng-app="MyApp" layout-fill layout-padding layout="column">
<div style="background: linear-gradient({{ctrl.color1}}, {{ctrl.color2}})" flex></div>
</div>
JS
angular.module('MyApp',['ngMaterial'])
.controller('AppCtrl', function($mdColors) {
this.color1 = $mdColors.getThemeColor('primary-600');
this.color2 = $mdColors.getThemeColor('primary-100');
});
Note that this won't work with IE. From the docs:
Upvotes: 3