Issue
I'am trying to create a ngForm on a parent-component where I have a child-component with a ngModel on an input, I want my ngForm to get the value of the ngModel.
This is the error.
Error: Uncaught (in promise): Error: No value accessor for form control with name: 'InputName'
Let me know if you need anything else.
Solution
You can just add 'ngDefaultControl' to your child where you have the ngModel attribute, and it works fine.
<child [name]="'InputName'" [type]="'text'" ngModel ngDefaultControl></child>
For detailed explanations please refer below:
Answered By - Anna
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.