SyntaxError:在角度2中使用* ngFor时无效的字符

时间:2017-03-09 21:55:30

标签: html angular typescript primeng

为什么在纯html控件上使用*ngFor时,角度2不起作用?

这是我的完整语法代码

<p-dialog [header]="headername" [(visible)]="displayDialog" showEffect="fade" modal="true" [responsive]="true">
    <p-messages [value]="errormessage"></p-messages>

    <a (click)="AddData()" href="Javascript:void(0);" class="a-l2-link left" pTooltip="Add New" tooltipPosition="top"><i class="fa fa-plus-circle" aria-hidden="true"></i><u>Add</u></a>

        <div *ngFor="let datarow of cocVersionPopUpPage.CoCVariantExtendedDataRow">
            <table style="width: 100%;">
                <tr style="width: 100%;">
                    <td class="headermain">structurWeek</td>
                    <td class="headermain"> Option</td>
                    <td class="headermain"> Sales Version</td>
                    <td class="headermain"> Marketing Code</td>
                    <td *ngFor="let extendLable of datarow.VariantExtendedValueCollection">{{extendLable.ElementName}}</td>
                </tr>
            </table>
            <table class="u7463_div">
                <tr>
                    <td class="clmMaintd"> <input class="inputsyle" type="text" /></td>
                    <td class="clmMaintd"> <input class="inputsyle" type="text" /></td>
                    <td class="clmMaintd"> <input class="inputsyle" type="text" /></td>
                    <td class="clmMaintd"></td>
                    <td class="clmMaintd" *ngFor="let extendLable of datarow.VariantExtendedValueCollection"><input class="inputsyle" [(ngModel)]="extendLable.VariantExtendedValue" type="text" /> </td>
                </tr>
            </table>
            <div class="divstle">
                <table style="width: 100%;">
                    <tr>
                        <!--<td> for language lable</td>-->
                        <td *ngFor="let variantLable of datarow.cocVariantLableCollection" class="subheadstyle">{{variantLable.VariantLables}}</td>
                    </tr>

                </table>
                <table style="width: 100%;">
                    <tr>
                        <td *ngFor="let ElementValues of datarow.cocVariantElementValues" class="borderclm"> <input class="inputsyle" [(ngModel)]="ElementValues.VariantValue" type="text" /></td>
                    </tr>
                    <tr>
                        <!--<td> for language lable</td>-->
                        <td *ngFor="let ElementValues of datarow.cocVariantElementValues" class="borderclm">
                            <input class="inputsyle" [(ngModel)]="ElementValues.VariantValue" type="text" />
                            <br />
                            <table>
                                <tr *ngFor="let languages of ElementValues.cocElementLanguageDataCollection">
                                    <td><input class="inputsyle" [(ngModel)]="languages.TranslationValue" type="text" /></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>

            </div>
            <a (click)="AddData()" href="Javascript:void(0);" class="a-l2-link left" pTooltip="Add New" tooltipPosition="top"><i class="fa fa-plus-circle" aria-hidden="true"></i><u>Remove</u></a>


        </div>

    <footer>
        <div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix">
            <button type="button" pButton icon="fa-angle-right" (click)="displayDialog=false" label="Cancel"></button>
            <button type="button" pButton icon="fa-angle-right" (click)="SaveVersion()" label="Save"></button>
        </div>
    </footer>
</p-dialog>

我收到了下面附带的错误

enter image description here

如果删除ngfor,那么它正在运行。但我应该使用ngFor与纯html格式化表格。 (我不想要模板场景)

此外,我已阅读以下讨论

AngularJS 2.0 - ng-repeat

已经解释过ngfor正在尝试我的工作。但在我身边它不起作用

** :我使用 primeNg 和html

0 个答案:

没有答案