używam szablonu jak następuje:Jak zastosować wiele powiązań szablonów na jednym elemencie w angular2
<ul [ngClass]="{dispN: !shwFilter,'list-group':true,'autoS':true,'dispB':shwFilter,'myshddw':true}" style=";display: none">
<li *ngIf="itsNotF && itsNotF.length" [ngClass]="{bgDFF: !colps[j],'list-group-item':true}" *ngFor="let valm1 of itsNotF;let j=index;" (click)="togFltr(j)" style="padding: 0;background: #fff">
<div *ngIf="valm1 && valm1.type=='1'">
<h5 style="padding:8px;margin: 0;">{{valm1['header']}}</h5>
<p style="margin: 8px;">{{valm1['body']}}</p>
<h6 style="padding:8px;margin: 0;">{{valm1['note']}}</h6>
</div>
<div *ngIf="valm1 && valm1.type=='2'" (click)="modlTxt=valm1;notREadVu(j)" data-toggle="modal" data-target="#myModal">
<h5 style="padding:8px;margin: 0;">{{valm1['header']}}</h5>
<h6 style="padding:8px;margin: 0;">{{valm1['note']}}</h6>
</div>
<div *ngIf="valm1 && valm1.type=='3'">
<h5 style="padding:8px;margin: 0;">{{valm1['header']}}</h5>
<p style="margin: 8px;">{{valm1['body']}}</p>
<h6 style="padding:8px;margin: 0;">{{valm1['note']}}</h6>
</div>
</li>
<li [ngClass]="{bgDFF: !colps[j],'list-group-item':true,'lgOt':true}" (click)="logout()">
<span class="title">Log Out <i class="fa fa-sign-out"></i></span>
</li>
</ul>
więc daje następujący błąd:
EXCEPTION: Template parse errors:
Can't have multiple template bindings on one element. Use only one attribute named 'template' or prefixed with * ("one">
<li *ngIf="itsNotF && itsNotF.length" [ngClass]="{bgDFF: !colps[j],'list-group-item':true}" [ERROR ->]*ngFor="let valm1 of itsNotF;let j=index;" (click)="togFltr(j)" style="padding: 0;background: #fff">
"): [email protected]:94
Previously it was not giving error I faced this issue after upgrading to RC4.
So what's workaround, so I can apply multiple template binding on single element without altering Template structure.
'' ngFor' ngIf' i oba są wytyczne konstrukcyjne, nie mogą być tam w tym samym elemencie .. dla workaroud można sprawdzić ten problem [GitHub coment] (https: // GitHub. com/angle/angle/issues/7315 # issuecomment-232083676) –
Ale wcześniej (RC1) działało. –