d-man
d-man

Reputation: 58083

angular2 form invalid property in hidden field

I have form object "formObject" and i want to have a form.invalid in formObject.isFormValid variable.

any help is appreciated.

export class formObject{

public isFormValid:boolean ;
.. other fields

}

<form #my-form="ngForm" >
<input type="hidden" [(ngModel)]="formObject.isFormValid" value="my-form.invalid"/> {{my-form.invalid}}
</form>

Upvotes: 0

Views: 1245

Answers (1)

kemsky
kemsky

Reputation: 15270

Setting value attribute does not trigger change for input and model is not updated. You have to use another way to update formObject.isFormValid.

Upvotes: 1

Related Questions