Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ironControl needed for paper-textarea? #35

Closed
BorntraegerMarc opened this issue Jun 20, 2017 · 1 comment
Closed

ironControl needed for paper-textarea? #35

BorntraegerMarc opened this issue Jun 20, 2017 · 1 comment
Labels

Comments

@BorntraegerMarc
Copy link
Contributor

So, I have a question, which confuses me a bit. I have in literally only one component this html:

        <form id="newTaskForm" [formGroup]="newTaskForm" (ngSubmit)="confirmAddTask()">
            <div class="komed-text-subtitle add-task-title">{{'task.addTask' | translate}}</div>
            <paper-input #titleInput label="{{'task.title' | translate}}" type="text" id="taskTitle" class="form-control" formControlName="taskTitle"
                name="taskTitle">
            </paper-input>
            <paper-textarea label="{{'task.description' | translate}}" id="description" class="form-control" formControlName="description"
                name="description" max-rows="3">
            </paper-textarea>
        </form>

And this TS:

        this.newTaskForm = this.fb.group({
            taskTitle: ['', [Validators.required, Validators.minLength(1)]],
            description: ['', [Validators.required, Validators.minLength(1)]]
        });

Generates this error:

ERROR Error: No value accessor for form control with name: 'description'
    at _throwError (forms.es5.js:1830)
    at setUpControl (forms.es5.js:1740)
    at FormGroupDirective.addControl (forms.es5.js:4711)
    at FormControlName._setUpControl (forms.es5.js:5299)
    at FormControlName.ngOnChanges (forms.es5.js:5217)
    at checkAndUpdateDirectiveInline (core.es5.js:10812)
    at checkAndUpdateNodeInline (core.es5.js:12238)
    at checkAndUpdateNode (core.es5.js:12177)
    at debugCheckAndUpdateNode (core.es5.js:12880)
    at debugCheckDirectivesFn (core.es5.js:12821)

If I now only add ironControl to only the paper-textarea:

            <paper-textarea label="{{'task.description' | translate}}" id="description" class="form-control" formControlName="description"
                name="description" max-rows="3" ironControl>
            </paper-textarea>

Everything works fine... Could you help me out to understand why only the paper-textarea needs the attribute?

@hotforfeature
Copy link
Owner

Because I forgot to add "paper-textarea" to the list of selectors for paper controls :(

Dead easy fix. I'll do it later today, and of course the workaround is to just add [ironControl] to your text areas.

Keep in mind that when the fix does hit your codebase, you'll need to remove the [ironControl] attribute or you will get a runtime error because the textarea will have two value accessors (Angular doesn't like that).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants