Angular官网例子错误的解决

Posted on 2020-03-04 07:47  wzhw2015  阅读(247)  评论(0编辑  收藏  举报

1.<div *ngFor="let product of products; index as productId">

解决策:<div *ngFor="let product of products; let index = productId">

 

2.this.route.paramMap.subscribe(params => { this.product = products[+params.get('productId')]; });

解决策:this.route.params.subscribe(params => {this.product = products[+params['productId']];});

 

3.这个报错的解决案

 

 解决策:app.module.ts加上下面

 

              product-detail.components.ts加上下面

 

Copyright © 2024 wzhw2015
Powered by .NET 9.0 on Kubernetes