[我最近尝试了Angular 9,并且在* ngI和* ngor的结构化指令中出现问题,并且在我的控制台中没有错误显示,我也试图更改tsconfig.json文件,如下所示进行修改
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"enableIvy": false
}
但问题仍未解决,这是我的版本
Angular CLI: 9.0.5
Node: 12.16.1
OS: win32 x64
Angular:
...
Ivy Workspace:
Package Version
------------------------------------------------------
@angular-devkit/architect 0.900.5
@angular-devkit/core 9.0.5
@angular-devkit/schematics 9.0.5
@schematics/angular 9.0.5
@schematics/update 0.900.5
rxjs 6.5.3
这是我的源代码:
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-product-list',
templateUrl: './product-list.component.html',
styleUrls: ['./product-list.component.css']
})
export class ProductListComponent implements OnInit {
productList = 'Product List';
products: [
{
productId: 2,
productName: 'Garden Cart',
productCode: 'GDN-0023',
releaseDate: 'March 18, 2019',
description: 'description',
price: 150.00,
starRating: 4.2,
imageUrl: 'assest/image/garden-cart.png'
},
{
productId: 2,
productName: 'Garden Cart',
productCode: 'GDN-0023',
releaseDate: 'March 18, 2019',
description: 'description',
price: 150.00,
starRating: 4.2,
imageUrl: 'assest/image/garden-cart.png'
}
];
constructor() { }
ngOnInit(): void {
}
}
HTML文件
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>
<button class="btn btn-primary"> Show Image</button>
</th>
<th>Product</th>
<th>Code</th>
<th>Available</th>
<th>Price</th>
<th>5 Start Rating</th>
</tr>
</thead>
<tbody *ngFor="let product of products">
<tr >
<td>{{product.productName}}</td>
<td>{{product.productCode}}</td>
<td>{{product.description}}</td>
<td>{{product.price}}</td>
<td>{{product.starRating}}</td>
</tr>
</tbody>
</table>
</div>
然后我的应用程序使用ng-serve表数据运行,但对我没有显示什么问题?
products:any=value