完整代码是:
<input #inputSearch tabindex="0" [(ngModel)]="searchValue" (keydown.enter)="searchByClick()" type="text">
应用程序模块为:
@NgModule({
declarations: [],
imports: [
CommonModule,
SharedModule,
BrowserModule,
AppRoutingModule
]
)}
export class AppModule {}
出什么问题了,为什么它对我不起作用?
答案 0 :(得分:1)
尝试一下:
import { FormsModule } from '@angular/forms';
将此模块添加到您的:
@NgModule({
declarations: [],
imports: [
CommonModule,
SharedModule,
BrowserModule,
FormsModule,
AppRoutingModule
]
)}
export class AppModule {}
答案 1 :(得分:1)
import { FormsModule } from '@angular/forms';
import { NgModule } from "@angular/core";
在app.module.ts中导入FormsModule和NgModule