【发布时间】:2022-11-11 10:07:57
【问题描述】:
这是对话内容
<div mat-dialog-content>
<form>
<h1>New Shipment</h1>
<div class="form-outline mb-4">
<select #shipmentStatusd name="cars" class="form-control">
<div *ngFor="let status of shipmentStatuses">{{status}}</div>
</select>
<label class="form-label">shipmentStatus</label>
</div>
</form>
</div>
在对话框的 component.ts 中,我有这个变量
shipmentStatuses = ["INITIATED", "SENT", "ARRIVED", "DELIVERED"];
这是我的应用程序模块(我只有一个)
@NgModule({
declarations: [
AppComponent,
UsersComponent,
LoginComponent,
CompaniesComponent,
OfficesComponent,
ShipmentsComponent
],
imports: [
AppRoutingModule,
CommonModule,
FormsModule,
ReactiveFormsModule,
BrowserModule,
FontAwesomeModule,
RouterModule,
HttpClientModule,
BrowserAnimationsModule,
MatCardModule,
MatIconModule,
MatChipsModule,
MatInputModule,
MatDialogModule,
],
providers: [
AuthGuardService,
AuthService
],
bootstrap: [AppComponent]
})
export class AppModule { }
我收到这个错误
NG0303: Can't bind to 'ngForOf' since it isn't a known property of 'div'.
我真的不知道发生了什么,我也不能在对话框中使用 ngModel
【问题讨论】:
标签: angular typescript angular-material