You can use the .dirty
(or .pristine
) values to determine if a user has used the UI to change the control value:
<button class="btn btn-primary" type="button" (click)="save()" [disabled]="!form.dirty" >Save</button>
<button class="btn btn-primary" type="button" [disabled]="!form.dirty"(click)="cancel()">Cancel</button>
https://angular.io/docs/ts/latest/api/forms/index/AbstractControl-class.html#!#dirty-anchor
dirty : boolean A control is dirty if the user has changed the value
in the UI.Note that programmatic changes to a control’s value will not mark it
dirty.touched : boolean A control is marked touched once the user has
triggered a blur event on it.