Complete the code to bind a CSS class dynamically using ngClass.
<div [ngClass]="'[1]'">Hello World</div>
The ngClass directive expects a string or expression that evaluates to a class name or object. Here, "active" is a valid class name string.
Complete the code to apply multiple classes conditionally using ngClass with an object.
<div [ngClass]="{ 'highlight': isActive, [1] }">Content</div>
In ngClass, you can pass an object where keys are class names and values are booleans. Here, 'disabled': isDisabled adds the 'disabled' class if isDisabled is true.
Fix the error in the ngClass binding to correctly apply the class based on the condition.
<div [ngClass]="[1]">Example</div>
The correct syntax for conditional classes in ngClass is an object with class names as keys and boolean expressions as values, like { active: isActive }.
Fill both blanks to apply classes conditionally using ngClass with an object and a string.
<div [ngClass]="{ [1]: isError, '[2]' }">Message</div>
The first blank should be the class name 'error' applied when isError is true. The second blank is another class name 'warning' which can be used as a static class or part of the object.
Fill all three blanks to create a dynamic class binding using ngClass with an object and a string.
<div [ngClass]="{ [1]: isPrimary, [2]: isSecondary } '[3]'">Button</div>
The first two blanks are class names used as keys in the object with boolean conditions. The third blank is a string with an extra static class applied always.