J
J
jenya77712017-02-15 00:28:09
Angular
jenya7771, 2017-02-15 00:28:09

How to change style in Angular based on condition?

How to set a certain style depending on the conditions?
For example if $scope.stage.status_stage = 1 then STYLE = color: #ccc

<tr ng-repeat="stage in stage" ng-style="STYLE">
          <td>{{$index+1}}</td>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
lega, 2017-02-15
@jenya7771

You can try like this:

ng-style="{color:stage.status_stage==1?'#ccc':''}"
или
style="{{stage.status_stage==1?'color: #ccc':''}}"

P
Philip Gaponenko, 2017-02-15
@filgaponenko

It is necessary to hang the class corresponding to the state through ngClass.
https://scotch.io/tutorials/the-many-ways-to-use-n...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question