ngStyle is used to interpolate javascript object into style attribute, not css class.
Following directive will be translated to style="color:red"
ngStyle="{color: 'red'}"
And ng-class directive translates your object into class attribute.
Following will be translated to class="deleted" when isDeleted variable is true.
ngClass="{'deleted': isDeleted}"
Following directive will be translated to style="color:red"
ngStyle="{color: 'red'}"
And ng-class directive translates your object into class attribute.
Following will be translated to class="deleted" when isDeleted variable is true.
ngClass="{'deleted': isDeleted}"
No comments:
Post a Comment