angular - Should *ngFor be used by templates internally, or should it be used externally? -


i've seen *ngfor used repeat child templates parent template, , seen used inside child template itself. there situation in either of these should preferred?

<div class="results">   <app-result-tile     *ngfor="let d of service.data"     [data]="d">   </app-property-tile> </div> 

or should move ngfor <app-result-tile> component?

<div class="results">   <app-result-tiles     [data]="service.data"> <!-- results repeat internally li's or something.-->   </app-result-tiles> </div> 

i'll writing pipe filter result component(s) parent component. make more sense use first method in case?

the question here should iterated item form separate component or not.

the answer yes if iterated item used on own.

if without exception, both , in future, never used on own within list, ngfor* should used inside child component.

if there pipe filtering or not on ngfor* irrelevant.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -