My form has 10 to 15 fields I just want to watch the changes on 2 fields built using form-builder.
Currently i can watch all the fields in the form using the following code :
export class App {
constructor(private formBuilder: FormBuilder) {
this.form = formBuilder.group({
firstName: 'John',
lastName: 'Fleming',
Name: 'John Fleming',
Address : '12331 wiley post',
city: '',
state:'',
...... so on
})
this.form.valueChanges.subscribe(data => {
console.log('Form changes', data)
this.output = data
})
}
}
I don't want to watch all the fields, I used (keyup) event on those fields to handle it for now. But I want to know whether there is any better way of doing the same in angular2?