Solution: Practice with Directives

Let’s compare our results against the expected outcome.

We'll cover the following


The only thing we need to change is the directive’s selector. We can match all elements with the class name header as follows:

  selector: '.header'
export class BoldDirective {

  constructor(el: ElementRef) { = 'bold';


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

Get hands-on with 1200+ tech skills courses.