There are two terms in angular 5 SimpleChange and SimpleChanges, I didn't understand clearly from the official document could someone please explain me ??/
SimpleChange is a class which is used as a type of all the properties in SimpleChanges interface.
class SimpleChange {
    previousValue: any;
    currentValue: any;
    firstChange: boolean;
    constructor(previousValue: any, currentValue: any, firstChange: boolean)
    isFirstChange(): boolean
}
interface SimpleChanges {
    __index(propName: string): SimpleChange
}
                        SimpleChange class represents a basic change from a previous to new value. 
It has following properties.
previousValue: Keeps previous value of input property. 
currentValue: Keeps current value of input property. 
isFirstChange(): Boolean value that tells whether the new value is the first value assigned. 
https://angular.io/api/core/SimpleChange
SimpleChanges is the interface that represents all input changes as object for a component. SimpleChanges has the key as input property names and values are the instances of SimpleChange class.
e.g: 
@input() id: number;
@input() name: string;
ngOnChanges(changes: SimpleChanges) {
  console.log(changes);
}
// Output
{id: SimpleChange, name: SimpleChange}
https://angular.io/api/core/SimpleChanges
Source: https://www.concretepage.com/angular-2/angular-2-4-onchanges-simplechanges-example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With