As you start newly with angular, ngModel and ngModelChange are the things you probably try to implement and check first. ngModel is a directive which binds input type controls (select, textarea), and stores the required user value in a variable and we can use that variable whenever we require that value. whereas ngModelChange is the @Output of ngModel directive. It fires when the model changes. You cannot use this event without ngModel directive. and when you do some changes in the view, you expect you will get the latest model changes in the listener function you have configured on modelChange. Well it don't work always. It's returning previous value every single time. Check this following code snippet carefully. Both looks same. Only difference is the sequence in which (ngModelChange) and [(ngModel)] are placed. < h1 > ganeshk4 </ h1 > < select ( ngModelChange ) = "onSelection()" [( ngModel )] = "selectedOption...
Comments
Post a Comment