1

I'm trying to bind a variable to a header to show what the current step is (ie, 'You are on step 1 of 10'). I have it working for a textarea and can't figure out why it doesn't work for a header.

private mainStepText: String = "Welcome";
<div class="mainWindow">
   <textarea [(ngModel)]="mainStepText"></textarea> 
</div>

What I have so far is

private testLabel: String = "This is a test label for html";
<div class="test">
  <h3 class="labelName" [(ngModel)]="testLabel"></h3>
</div>

Right now it throws an error

"ERROR Error: Uncaught (in promise): Error: No value accessor for form control with unspecified name attribute Error: No value accessor for form control with unspecified name attribute"

1 Answer 1

4

Instead of ngModel in the tag. Just do:

<h3 class="labelName">{{testLabel}}</h3>

and set testLabel in your component

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, that was exactly what I was looking for, worked perfectly.
Happy to help. If this answer or any other one solved your issue, please mark it as accepted.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.