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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.