It-Z
It-Z

Reputation: 2000

Change class of Angular Material elements

Is there any thing similar to angular.js ng-class in angular material?

I want to be able to change the class of elements based on values from the controller and I can't find any way to do so.

In the samples I saw a way to change the style attribute but this looks ugly when there are many styles to change.

Upvotes: 1

Views: 769

Answers (1)

oKonyk
oKonyk

Reputation: 1476

Since angular material app is still angular app, ng-class is working the regular way.

<div ng-class="{'my-bacground': isClass}">

where 'my-bacground' is name of class and isClass is name of variable attached to $scope.

Please see plunk for working example.

Upvotes: 2

Related Questions