ngFor 在我的应用程序中不起作用。
我将我的应用程序拆分为单独的模块并包含import { CommonModule } from '@angular/common';在我的子模块和import { BrowserModule } from '@angular/platform-browser';我的app.modules.ts文件中,但我仍然收到以下错误。
Can't bind to 'ngForOf' since it isn't a known property of 'tr'.
Run Code Online (Sandbox Code Playgroud)
我曾尝试查看其他问题,但所有这些问题都只是对include CommonModule,我就是。
这些是我的文件:
crud-list.component.html
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Id</th>
</tr>
</thead>
<tbody>
<tr *ngFor='let item of cruds'>
<td>{{item.OrderNumber}}</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
crud-list.component.ts
import { Component, OnInit } from '@angular/core';
import { CrudRequestService } from '@modules/crud/crud-services/crud-request.service';
@Component({
selector: 'app-crud-list',
templateUrl: './crud-list.component.html',
styleUrls: ['./crud-list.component.scss']
})
export class …Run Code Online (Sandbox Code Playgroud)