Last active
March 14, 2018 13:03
-
-
Save YonathanMeguira/e4d505d55805b18e273789cbf93ae337 to your computer and use it in GitHub Desktop.
watch changes in input decorators
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// set up some class with an input decorator (the one we want to watch and act upon change | |
export class MyComponent { | |
myBooleanValue: boolean; | |
@Input() | |
set myBooleanValue(newValue: boolean) { | |
// will display this message as soon as the value of 'myBooleanValue' changes | |
console.log(`old value was ${this.booleanValue}, new value is ${newValue}`; | |
this.myBooleanValue = newValue; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment