• Register
0 votes
98 views

Problem :

I am facing below error when trying to launch my Angular app, even if my component is not displayed at all.

Can't bind to 'ngmodel' since it isn't a known property of 'input'. ("

 How can I fix this issue?

8 4 2
2,300 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I had faced this issue while writing my first code in Angular App. The solution is easy just follow below procedure.

Lets assume that you are creating the  new NgModule, say some AuthModule which is dedicated towards handling all your Auth needs, then you must import FormsModule in your AuthModule too.

If you want to use the FormsModule only in your AuthModule then you dont need to import your FormModule in your default AppModule

So write below code in your AuthModule:

import { NgModule }      from '@angular/core';
import { FormsModule } from '@angular/forms';
import { authRouting } from './auth.routing';
import { LoginComponent, SignupComponent } from './auth.component';

@NgModule({
  imports:      [ 
    authRouting,
    FormsModule
   ],
  declarations: [ 
    SignupComponent,
    LoginComponent
  ]
})
export class AuthModule { }

Then just forget about the importing in the AppModule if you don't want to use your FormsModule anywhere else.

If you want to use the two-way data binding for the form inputs then you need to import your FormsModule package in the Angular module.

5 2 1
4,980 points

Related questions

0 votes
1 answer 2 views
2 views
Problem: I'm using Angular 4 and I am getting an error in the console: Can't bind to 'ngModel' since it isn't a known property of 'input' How can I resolve this?
asked 4 days ago anika11 32.2k points
0 votes
1 answer 31 views
31 views
Problem: How can I fix this : Can't bind to 'formcontrol' since it isn't a known property of 'input'
asked Mar 14 Wafa Abu Yousef 6.1k points
0 votes
1 answer 2.4K views
2.4K views
Problem : I am beginner in using Angular material. I am trying to use autocomplete component in the Angular2 project. Please find below the code written for my component. import {Component, OnInit} from "@angular/core"; import {ActivatedRoute, Router} from "@angular/router"; ... ; I am struggling with this issue from past 2 days but unable to resolve it. Can somebody help me in fixing this issue?
asked Feb 27, 2020 mphil 2.3k points
0 votes
1 answer 7 views
7 views
Problem: ngFor isn't working in my app. I split my app into separate modules and included import { CommonModule } from '@angular/common'; into my child module and import { BrowserModule } from '@angular/platform-browser'; into my app.modules.ts file, but I still get ... t a known property of 'tr'. I have tried looking at other questions but all those just said to include CommonModule, which I am.
asked 4 days ago anika11 32.2k points
1 vote
2 answers 205 views
205 views
Problem : I am beginner to Angular2. Currently I am trying to create a simple form in the Angular2 app but it is not working for me. I am facing below error. “Can't bind to 'formGroup' since it isn't a known property of 'form'.” I am struggling on this error from couple of days. Still I don’t know how to fix above error. Is it possible for somebody to fix it for me?
asked Mar 27, 2020 morrisBson 3.2k points
0 votes
1 answer 12 views
12 views
Problem: please solve it ... can't bind to 'ngmodel' since it isn't a known property of 'input'. angular 2
asked Apr 1 Ifra 36.4k points
0 votes
1 answer 41 views
41 views
Problem: I can't bind to 'ngmodel' since it isn't a known property of 'input'. Kindly help..!
asked Mar 6 Umar Ahmad 4.1k points
0 votes
1 answer 21 views
21 views
Problem: I can't bind to 'ngmodel' since it isn't a known property of 'input'.. Kindly help!
asked Mar 6 Umar Ahmad 4.1k points
0 votes
1 answer 8 views
8 views
Problem: I am new in angular 5 development. I am trying to develop a data table with angular material using the example provided here: "material.angular.io/components/table/examples". I am getting an error saying Can't bind to 'dataSource' since it isn't a known property of 'table'. Please help.
asked 6 days ago padma1 34.8k points
0 votes
1 answer 17 views
17 views
Problem: Can anyone explain this,Can't bind to 'ngforin' since it isn't a known property of 'div'?
asked Apr 11 Humaira ahmed 50.7k points