docs: use SimpleChanges in component interaction guide (#39342)
Use the SimpleChanges interface in the example of component interaction guide PR Close #39342
This commit is contained in:
parent
90c0772743
commit
cf60e0e889
|
@ -1,6 +1,6 @@
|
|||
/* tslint:disable:forin */
|
||||
// #docregion
|
||||
import { Component, Input, OnChanges, SimpleChange } from '@angular/core';
|
||||
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-version-child',
|
||||
|
@ -17,7 +17,7 @@ export class VersionChildComponent implements OnChanges {
|
|||
@Input() minor: number;
|
||||
changeLog: string[] = [];
|
||||
|
||||
ngOnChanges(changes: {[propKey: string]: SimpleChange}) {
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
const log: string[] = [];
|
||||
for (const propName in changes) {
|
||||
const changedProp = changes[propName];
|
||||
|
|
|
@ -4,7 +4,7 @@ import { Component, ContentChildren, Directive, EventEmitter,
|
|||
HostBinding, HostListener,
|
||||
OnInit, OnChanges, OnDestroy,
|
||||
Pipe, PipeTransform,
|
||||
SimpleChange } from '@angular/core';
|
||||
SimpleChanges } from '@angular/core';
|
||||
|
||||
import { of } from 'rxjs';
|
||||
import { delay } from 'rxjs/operators';
|
||||
|
@ -309,7 +309,7 @@ export class MyIfChildComponent implements OnInit, OnChanges, OnDestroy {
|
|||
this.changeLog.push('ngOnDestroy called');
|
||||
}
|
||||
|
||||
ngOnChanges(changes: {[propertyName: string]: SimpleChange}) {
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
for (const propName in changes) {
|
||||
this.ngOnChangesCounter += 1;
|
||||
const prop = changes[propName];
|
||||
|
|
Loading…
Reference in New Issue