ng-change = "ControllerName.functionName()"
here I want to add one more function to that. How can I do that ?
Thanks in advance.
Yes, you can call two JS Function on one onClick.
The ng-change event is triggered at every change in the value. It will not wait until all changes are made, or when the input field loses focus. The ng-change event is only triggered if there is a actual change in the input value, and not if the change was made from a JavaScript.
ngOnChanges(): "A lifecycle hook that is called when any data-bound property of a directive changes. Define an ngOnChanges() method to handle the changes." We use this lifecycle hook to respond to changes to our @Input() variables.
This should do the trick:
ng-change = "ControllerName.functionName(); ControllerName.anotherFunction();"
Why not rather group the functions in the controller inside another function?
function onChangeGroup(){ doStuff(); doMoreStuff(); } <input ng-change="ControllerName.onChangeGroup()"/>
Regards
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