1

I am updating my project's angular version from v2.0.0-beta.6 to v4.1.1.

Normally, I update from

<input type="text" ngControl="name" .../>

to

<input type="text" #name="ngModel" .../>

It works well in my project until I met this:

<input type="text" required ngControl="{{[param.key]}}"  [(ngModel)]="params[param.key]" ... />

How can I set the attribute name variable? Thanks!

3
  • I think <input type="text" #name="ngModel" .../> should be <input type="text" name="name" .../> Commented May 22, 2017 at 8:28
  • 2
    Possible duplicate of Angular2 binding of "name" attribute in <input> elements with *ngFor Commented May 22, 2017 at 8:29
  • Thanks. It works well when I add [ngModelOptions]="{standalone: true}" in my input. Sometimes I just can't get the deep difference between name attribute and [ngModelOptions] when I used [(ngModel)] in my input. Commented May 22, 2017 at 12:12

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.