Creating an editor component

First, let's create a new stub component for our editor using the Angular CLI:

ng generate component --spec false -ve none -cd onpush ui/editor/editor

After the files have been generated, so let's open up the component class located in src/ui/editor/editor.component.ts and apply the following code changes:

import {  AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, EventEmitter, HostBinding, HostListener,   Input, OnChanges, Output, SimpleChanges, ViewChild, ViewEncapsulation} from '@angular/core';@Component({  selector: 'mac-editor',  templateUrl: './editor.component.html',  styleUrls: ['./editor.component.css'],  encapsulation: ViewEncapsulation.None,  changeDetection: ChangeDetectionStrategy.OnPush}) ...

Get Mastering Angular Components now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.