Angular: Manually update an input model but not the view

Angular: Manually update an input model but not the view


I’ve connected the google place autocomplete to an input field.

Well, while the input shows something like “Milano, MI, Italia”, I want to send to the API just the place_id (that the server will validate again by using the maps api)
Surely, I need to update the model and define a remote validator to set the field as valid.

The manual update is made by the setValue method.
By setting {emitModelToViewChange: false} I avoid the view gets updated.

That’s all!

 

Leave a Reply

Your email address will not be published. Required fields are marked *