簡體   English   中英

無法綁定到“ ngForOf”,因為它不是“ tr”的已知屬性

[英]Can't bind to 'ngForOf' since it isn't a known property of 'tr'

我看到了很多答案,我想我已經遵循了所有建議,但是對於我的一生,我不知道有什么遺漏。 我已經將CommonModule導入到我的模塊中,並導出了該組件,但是仍然沒有。

我有第二個模塊:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { EmployeedbComponent } from './employeedb.component';


@NgModule({
  imports: [
    CommonModule
  ],
  exports: [EmployeedbComponent],
  declarations: [EmployeedbComponent]
})
export class EmployeedbModule { }

我的組件只有一個稱為項的數組。

我的html是:

<tr *ngFor="let item of items">


         </tr>

將BrowserModule添加到導入中:[]在@NgModule() ,應將BrowserModule導入到app模塊中,在其他模塊中,應當將CommonModule導入

@NgModule({
  imports: [BrowserModule]
  ..
})

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM