error

Niharika Arora asked 7 years ago

my browser window is blankand errors in console:Uncaught Error: Template parse errors:Can't bind to 'ngModel' since it isn't a known property of 'input'. (" <input mdbActive type="text" placeholder="Add new category" id="form1" class="form-control" [ERROR ->][(ngModel)]="newCategory.name"(keyup.enter)="addCategory()" name="addCat">"): ng:///AppModule/AppComponent.html@15:106Can't bind to 'ngModel' since it isn't a known property of 'input'. ("/i></a><input mdbActive type="text" id="form2" class="form-control" [ERROR ->][(ngModel)]="newTodo.title" (keyup.enter)="addTodo()" name="addNew"><label for="form2"): ng:///AppModule/AppComponent.html@51:75at syntaxError (compiler.js:215)at TemplateParser.push../node_modules/@angular/compiler/fesm5/compiler.js.TemplateParser.parse (compiler.js:14705)at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._parseTemplate (compiler.js:22712)at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileTemplate (compiler.js:22699)at compiler.js:22642at Set.forEach (<anonymous>)at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileComponents (compiler.js:22642)at compiler.js:22552at Object.then (compiler.js:206)at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileModuleAndComponents (compiler.js:22551)

Damian Gemza staff commented 7 years ago

Dear Niharika Arora, ngModel requires to import FormsModule from @angular/forms into your app.module.ts file. Import it, and your error should be gone. Best Regards, Damian

shahidfoy answered 6 years ago

adding this to app.modue.ts works:
import { FormsModule } from '@angular/forms';
then add FormsModule into imports:
imports: [

  BrowserModule,

  FormsModule,

  MDBBootstrapModule.forRoot()

],
 
Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No