Can't bind to 'ngModel' since it isn't a known property of 'input'

2,593 views
Skip to first unread message

Eduardo Cavalcanti

unread,
Aug 10, 2016, 12:48:37 PM8/10/16
to AngularJS
Has anyone else received an error like this after upgrading to RC5? It works fine under RC4.

It happens during the template compilation phase. A segment of the template follows:

<div>
  <button class="ui button" (click)="showCustGroupDialog()" >
    Incluir grupo econômico
  </button>

  <sn-sm-modal title="Incluir grupo econômico" #addCustGroupDialog [approve]="approveNewCustomerGroup">
    <modal-content>
      <div class="ui fluid input">
        <input class="ui input" type="text" [(ngModel)]="newCustGroupName" (keyup.enter)="approveNewCustomerGroup()" >
      </div>
    </modal-content>
    <modal-actions>
      <div class="ui cancel button">Cancelar</div>
      <div class="ui approve button">Salvar</div>
    </modal-actions>
  </sn-sm-modal>

Eduardo Cavalcanti

unread,
Aug 10, 2016, 2:41:27 PM8/10/16
to AngularJS
This is the error message:

"Template parse errors: Can't bind to 'ngModel' since it isn't a known property of 'input'. ("
 <modal-content>
 <div class="ui fluid input">
 <input class="ui input" type="text" [ERROR ->][(ngModel)]="newCustGroupName" (keyup.enter)="approveNewCustomerGroup()" >
 </div>
 </modal-c"): CustomerGroups@8:44

Lucas Lacroix

unread,
Aug 10, 2016, 3:11:07 PM8/10/16
to ang...@googlegroups.com
​I believe you're missing the directive for NgModel on your component.​

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.



--
Lucas Lacroix
Computer Scientist
System Technology Division, MEDITECH

Eduardo Cavalcanti

unread,
Aug 10, 2016, 3:54:51 PM8/10/16
to AngularJS
Thank you Lucas,

It was necessary to to mention
```
import { FormsModule }   from '@angular/forms';
```
and also to incorporate the new @NgModule syntax.


Nitin Kumar

unread,
Aug 11, 2016, 5:08:50 AM8/11/16
to AngularJS
Hi,

could you please post updated code as I am unable to get how did you remove this error?

Thanks

Nitin Kumar

unread,
Aug 11, 2016, 5:47:21 AM8/11/16
to AngularJS
Found the solution while Googling the error, I just tried this solution & it is working fine. I hope Eduardo did the same changes.

Eduardo Cavalcanti

unread,
Aug 11, 2016, 10:59:21 AM8/11/16
to AngularJS
Hi Nitin,
Thank you.
Angular 2 docs (https://angular.io/docs/ts/latest/)  are updated throughout with NgModule use.
There is also an specific RC4 to RC5 migration explanation in https://angular.io/docs/ts/latest/cookbook/rc4-to-rc5.html.
Regards.

zalabha...@gmail.com

unread,
Apr 4, 2019, 3:11:44 AM4/4/19
to Angular and AngularJS discussion
Hello sir,

I had already added formModule and ReactiveFormsModule but i getting same error. 

zalabha...@gmail.com

unread,
Apr 4, 2019, 3:11:44 AM4/4/19
to Angular and AngularJS discussion
I am getting same error please help me.

Sander Elias

unread,
Apr 4, 2019, 3:17:03 AM4/4/19
to Angular and AngularJS discussion
Make sure you added them to the module that your component is in.

zala bhavesh

unread,
Apr 4, 2019, 4:37:35 AM4/4/19
to ang...@googlegroups.com
Thanks sir,

solved error

On Thu, Apr 4, 2019 at 12:17 AM Sander Elias <sande...@gmail.com> wrote:
Make sure you added them to the module that your component is in.

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages