O'Reilly logo

Mastering Angular Components by Gion Kunz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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}) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required