Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

docs(lifecycle-hooks): SimpleChange -> SimpleChanges #2741 #2742

Merged
merged 1 commit into from
Nov 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// #docregion
import {
Component, Input,
OnChanges, SimpleChange,
OnChanges, SimpleChanges,
} from '@angular/core';

import { LoggerService } from './logger.service';
Expand All @@ -22,7 +22,7 @@ export class MyCounterComponent implements OnChanges {
@Input() counter: number;
changeLog: string[] = [];

ngOnChanges(changes: {[propertyName: string]: SimpleChange}) {
ngOnChanges(changes: SimpleChanges) {

// Empty the changeLog whenever counter goes to zero
// hint: this is a way to respond programmatically to external value changes.
Expand All @@ -36,7 +36,6 @@ export class MyCounterComponent implements OnChanges {
let prev = JSON.stringify(chng.previousValue); // first time is {}; after is integer
this.changeLog.push(`counter: currentValue = ${cur}, previousValue = ${prev}`);
}

}

/***************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// #docregion
import {
Component, Input, OnChanges,
SimpleChange, ViewChild
SimpleChanges, ViewChild
} from '@angular/core';

class Hero {
Expand Down Expand Up @@ -33,7 +33,7 @@ export class OnChangesComponent implements OnChanges {
changeLog: string[] = [];

// #docregion ng-on-changes
ngOnChanges(changes: {[propertyName: string]: SimpleChange}) {
ngOnChanges(changes: SimpleChanges) {
for (let propName in changes) {
let chng = changes[propName];
let cur = JSON.stringify(chng.currentValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
OnChanges,
OnDestroy,
OnInit,
SimpleChange
SimpleChanges
} from '@angular/core';
import { Component, Input } from '@angular/core';
import { LoggerService } from './logger.service';
Expand Down Expand Up @@ -51,7 +51,7 @@ export class PeekABooComponent extends PeekABoo implements
}

// only called for/if there is an @input variable set by parent.
ngOnChanges(changes: {[propertyName: string]: SimpleChange}) {
ngOnChanges(changes: SimpleChanges) {
let changesMsgs: string[] = [];
for (let propName in changes) {
if (propName === 'name') {
Expand Down