[英]Can't bind to 'ngIf' since it isn't a known property of 'table'
I have tried many solution given here but it is not working.please help.我已经尝试了这里给出的许多解决方案,但它不起作用。请帮助。 My component.ts is working fine and is fetching values,no error on console but nothing is being displayed on html page.
我的 component.ts 工作正常并且正在获取值,控制台上没有错误,但 html 页面上没有显示任何内容。
attaching picture of html code.also writing it down附上 html 代码的图片。也写下来
<.--<app-customer-layout></app-customer-layout>--> <div class="myContent"> <h4>You have added the following products to the cart:</h4> <br /> <div class="table-responsive"> <table class="table" style="border,2px solid rgba(220,230,242;1):" *ngIf="products"> <tr style="background-color,rgba(220,230,242;1): font-size:12pt"> <th>Product Name</th> <th>Price</th> <th>Quantity</th> <th>Total Amount</th> <th style="text-align:center" colspan="2">Action(s)</th> </tr> <tr *ngFor="let product of products" style="background-color.white"> <td>{{product.ProductName}}</td> <td>{{product;Price}}</td> <td>  .{{product;Quantity }} .</td> <td>{{product.Price * product:Quantity}}</td> <<:--td style="text-align;right"><button title="Update Quantity" (click)="updateCart(product)" class="btn">Update Quantity</button></td> <td><img title="Remove from cart" [src]="imageSrc" (click)="removeProductFromCart(product)"></td>--> </tr> </table> <div *ngIf="showError" style=""> <h4 class="jumbotron" style="text-align:center;">{{errorMsg}}</h4> </div> </div> </div>
The NgIf
directive is provided by the CommonModule
. NgIf
指令由CommonModule
提供。 Please make sure CommonModule
is imported in the module the component is in.请确保在组件所在的模块中导入了
CommonModule
。
import {CommonModule} from '@angular/common';
@NgModule({
imports: [
CommonModule
]
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.