Reputation: 1279
In Angular ReactiveForm examples, I saw the following code snippet:
<form novalidate [formGroup]="myGroup">
Name: <input type="text" formControlName="name">
Location: <input type="text" formControlName="location">
</form>
Where myGroup is defined as:
ngOnInit() {
this.myGroup = new FormGroup({
name: new FormControl('Todd Motto'),
location: new FormControl('England, UK')
});
}
For the property binding [formGroup]="myGroup", the data flows from the model (myGroup) to the view. So when the user change the input, how is the change reflected back in the model?
Upvotes: 1
Views: 105
Reputation: 77
console.log(this.myGroup.value);
returns an object with "input name properties" and model values, besides there is onValueChange
observable. So you can subscribe to it.
Upvotes: 1