简体   繁体   English

无法绑定到“ngIf”,因为它不是“表”的已知属性

[英]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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp.{{product;Quantity }}&nbsp.</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>

] 1 ] 1

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.

相关问题 Angular 6 无法绑定到“*ngIf”,因为它不是已知属性 - Angular 6 Can't bind to '*ngIf' since it isn't a known property 无法绑定到“ngif”,因为它不是“span”的已知属性 - Can't bind to 'ngif' since it isn't a known property of 'span' Angular 2无法绑定到'ngif',因为它不是已知属性 - Angular 2 Can't bind to 'ngif' since it isn't a known property 无法绑定到“ngIf”,因为它不是“form”的已知属性 - Can't bind to 'ngIf' since it isn't a known property of 'form' 无法绑定到dtOptions,因为它不是table的已知属性 - Can't bind to dtOptions since it isn't a known property of table 无法绑定到“dataSource”,因为它不是“table”的已知属性 - Can't bind to 'dataSource' since it isn't a known property of 'table' 无法绑定到“ ngIF”,因为它不是“ ion-item”的已知属性 - Can't bind to 'ngIF' since it isn't a known property of 'ion-item' angular 2 控制台错误无法绑定到“ngIf”,因为它不是“span”的已知属性 - angular 2 console error Can't bind to 'ngIf' since it isn't a known property of 'span' 错误:无法绑定到“ngIf”,因为它不是“form”的已知属性 - Error: Can't bind to 'ngIf' since it isn't a known property of 'form' Angular 抛出错误:无法绑定到“ngIf”,因为它不是“ng-container”的已知属性 - Angular throws error: can't bind to “ngIf” since it isn't a known property of “ng-container”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM