For example: ng-class="{red: By performing operations, you can dynamically add or delete classes, which is much more convenient than using javascript to add or delete classes in the class list
The value corresponding to the class used in our HTML is a string; The ng-xxx in angular corresponds to an expression. For example, the ng-class you encountered here corresponds to a key: value. When value is true, the key style is applied. For example ng-class="{ someClass : true }";
Note that if your style is some-class, it needs to be expressed as a string type, such as:
For example: ng-class="{red: By performing operations, you can dynamically add or delete classes, which is much more convenient than using javascript to add or delete classes in the class list
ngClass is used to dynamically add different classes based on conditions, but native classes do not have this effect
ng-class is a command that allows you to change the class based on logic
The value corresponding to the class used in our HTML is a string;
The ng-xxx in angular corresponds to an expression. For example, the ng-class you encountered here corresponds to a key: value.
When value is true, the key style is applied.
For example ng-class="{ someClass : true }";
Note that if your style is some-class, it needs to be expressed as a string type, such as:
ng-class="{ 'some-class' : true }";