-2

Full code is:

 <input #inputSearch tabindex="0" [(ngModel)]="searchValue" (keydown.enter)="searchByClick()" type="text"> 

app.module is:

@NgModule({ declarations: [], imports: [ CommonModule, SharedModule, BrowserModule, AppRoutingModule ] )} export class AppModule {} 

What is wrong, why it does not work for me?

5
  • can you paste your .ts fiile? Commented Feb 21, 2020 at 16:58
  • No, as you can see I have already applied in my code Commented Feb 21, 2020 at 17:00
  • You need to import FormsModule. You can find more here: stackoverflow.com/a/43298039/2959415 Commented Feb 21, 2020 at 17:00
  • I have tried impoer FormsModule, see my question again Commented Feb 21, 2020 at 17:00
  • @OPV sorry, but I don't see FormsModule in the listing of your AppModule's imports Commented Feb 21, 2020 at 17:03

2 Answers 2

2

import { FormsModule } from '@angular/forms'; import { NgModule } from "@angular/core"; Import FormsModule & NgModule in app.module.ts

Sign up to request clarification or add additional context in comments.

Comments

1

try this:

import { FormsModule } from '@angular/forms'; 

Add this module to your:

@NgModule({ declarations: [], imports: [ CommonModule, SharedModule, BrowserModule, FormsModule, AppRoutingModule ] )} export class AppModule {} 

5 Comments

No effect, I have found some the same question, I tested solutioins, no reslt
so paste your ts pls or we cannot understand why
Works like this (ngModel) but not [(ngModel)]
Which ts? Compoenent or module?
.ts i mean app component.ts

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.