Reputation: 12565
I have a code as below:
ngOnChanges(changes: {[property: string]: SimpleChange }) {
let change = changes["bgClass"];
let classList = this.element.nativeElement.classList;
I don't understand what this part means exactly:
changes: {[property: string]: SimpleChange }
Upvotes: 0
Views: 66
Reputation:
It means that you have an object-array []
named changes, consisting of several Sub-Objects {}
of type SimpleChange, that can be addressed by string [<object-name>: type]
.
changes: {[property: string]: SimpleChange }
So you could have something like this (just an example)
let changeClass = changes["bgClass"]; // you get the object named bgClass
let changeState = changes["disabled"]; // you get the object named disabled
...
This way you can examine what exactly changed and fired the change event.
Upvotes: 2