I want to compare if the two values of forms are the same. I have this
if(this.holdForm.value != this.positionForm.value){
this.enableButton = true;
}else{
this.enableButton = false;
}
but it doesn't work. It won't make enableButton true.
UPDATED:
this.positionForm = this.fb.group({
'name' : [position.name, Validators.required],
'remark': position.remark
});
this.holdForm = this.fb.group({
'name' : position.name,
'remark': position.remark
});
this.positionForm.valueChanges.subscribe(data => {
this.onValueChanged(data);
if(this.data.process == 'register'){
this.enableButton = true;
}else if(this.data.process == 'update' && this.holdForm.value != this.positionForm.value){
this.enableButton = true;
}else{
this.enableButton = false;
}
});