NG2: template ref errors out on missing ngModel directive...

69 views
Skip to first unread message

p. stephen w

unread,
Aug 13, 2016, 12:30:56 PM8/13/16
to AngularJS

Seems adding the #lname template ref is the problem.


       
<input [(ngModel)]="ng2Form.lname"
           
name="lname" id="lname"
           
type="text"
            #
lname="ngModel"
           
required
           
placeholder="Last name" />
...otherwise, the form works as expected.


Plunk: read the errors in the console.
Console error message:
There is no directive with "exportAs" set to "ngModel"
[ERROR ->]#lname="ngModel"
Enter code here...


Looks to be the same issue reported here:
https://github.com/angular/angular/issues/9363

p. stephen w

unread,
Aug 13, 2016, 12:43:55 PM8/13/16
to AngularJS
Seems upgrading ngForms to v.0.2.0 solves the problem.

p. stephen w

unread,
Aug 13, 2016, 1:08:53 PM8/13/16
to AngularJS
My local sandbox is running Fo...@0.2.0, and the error persisted.  It seems upgrading Typescript did the trick.
From: ^1.8.10
To: 1.9.0-dev.20160409
Reply all
Reply to author
Forward
0 new messages