Closed JacobBrandt closed 6 years ago
Hi @JacobBrandt, do you have a minimal plunker to illustrate your issue?
Just change any demo to use ngIf inside the ng-template tag. It doesn't behave like it should. It doesn't render anything if ngIf is used in this way.
As a workaround, you can create a component and do the *ngIf inside the component
Not working for me with "ngFor":
<od-virtualscroll [vsData]="innerData" [vsOptions]="options$" class="cells-container" >
<ng-template let-item let-row="row" let-column="column">
<div class="column" *ngFor="let ita of item" fxFlex>{{ ita }}</div>
</ng-template>
</od-virtualscroll>
I can put this in a new component, but this will add complexity in my code
Hey @raphdom, thanks for reporting. I've planned to investigate on this within this milestone.
Sorry, took me a while to get back. Yep, @JacobBrandt, please use the solution suggested by @ronzeidman .
I have no idea why something like this is not possible in Angular:
<ng-template let-item let-row="row" let-column="column">
<div *ngIf="row % 2 === 0" class="cell">
<div class="cell-info">
<span>Even Row: {{row}}</span><br>
<span>Column: {{column}}</span>
</div>
{{item}}
</div>
<div *ngIf="row % 2 !== 0" class="cell">
<div class="cell-info">
<span>Odd Row: {{row}}</span><br>
<span>Column: {{column}}</span>
</div>
{{item}}
</div>
</ng-template>
A clue anyone?
@raphdom if you're trying to use Angular flex please check the info here.
In my case, the od-virtualscroll throws the error TypeError: Cannot read property 'createEmbeddedView' of undefined
with *ngIf="true"
.
Just leaving this comment here for the guys (and google robots) to find the connection between the error and the reason of it.
I was unable to get *ngIf statements to work. Anyone else have any success with this?