The role of [(ngModel)] in angular2

[(ngModel)]: what I understand is that it can achieve two-way binding of user input and data, similar to the function of v-model in vue;
my operation: I have done a heroic component case of the angular2 tutorial, and finally I can change the heroic name (input), on the component details page and click back-the name I modified before has changed!
the page and details of the question: Top Heroes are on different pages, and the hero of the details page is passed from the route, so how does he send the change of name back to Top Heroes?

clipboard.png

clipboard.png

Mar.10,2021

this example ?

if so, your editing and saving of hero instances on the detail page will eventually make the data changes on the list page independent of ngModel, because the data sources of both detail and list come from HeroService , while HeroService itself is a singleton.

There is no strict bi-directional binding in

ng2, which is similar to vue's v-model. For example, v-model is also equivalent to : value and @ input . In the same way, [(ngModel)] is equivalent to (ngModelChange) and [ngModel] , along with some ng2 built-in formControl.

Menu