Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Simplest OnPush Example
Since all bound values arrive as inputs
this component is suitable for use with OnPush
<li *ngFor="let instructor of instructors">
{{ instructor }}
import { Component, Input, ChangeDetectionStrategy} from '@angular/core';
// Though this is a simple component, its template will only be checked for updates
// should a new list of instructors arrive.
// This is especially helpful when other portions of the application are undergoing
// frequent updates.
selector: 'app-instructor-list',
templateUrl: './instructor-list.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
export class InstructorListComponent {
@Input() instructors = [];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.