Components: Can't use ngModel and formControl at the same time ( Mat-Input )

Created on 6 Apr 2018  路  4Comments  路  Source: angular/components

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Form value with ngModel fields on form submit

What is the current behavior?

Form value doesn't contain form ngModel field on form submit

What are the steps to reproduce?

https://stackblitz.com/edit/angular-material2-issue?file=app%2Fapp.component.html

If i use #fieldname it can bind the value but the problem is i can't use [formControl] and #userCode="ngModel" at the same time.

`

userCode="ngModel" [formControl]="userNameFormControl"

        [errorStateMatcher]="matcher"

`

Most helpful comment

@sivahanuman I did this guide about forms and validations in angular 5 with material components .
There's also a code example you can use. Hope it helps :)

All 4 comments

@sivahanuman I did this guide about forms and validations in angular 5 with material components .
There's also a code example you can use. Hope it helps :)

I don't think ngModel and formControl are meant to be used together on the same element.

Thanks Dayana Jabif.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

savaryt picture savaryt  路  3Comments

jelbourn picture jelbourn  路  3Comments

kara picture kara  路  3Comments

RoxKilly picture RoxKilly  路  3Comments

vitaly-t picture vitaly-t  路  3Comments