...

/

Solution: The Built-in `NgClass` Directive

Solution: The Built-in `NgClass` Directive

Let’s compare the task result with the expected result.

An NgClass with a string expression

Let’s take a look at the task where we implemented an NgClass with a string expression.

Solution

Here’s an example of what the solution for this task may look like:

Solution for the task with a string expression

Explained

The primary technique is using the getter function to return the proper string with all the CSS classes that we require. As we can see, there’s a simple ...