Dont display categories until images are ready
This commit is contained in:
		@@ -1,11 +1,13 @@
 | 
				
			|||||||
<div class="container">
 | 
					<div class="container">
 | 
				
			||||||
    <div class="row py-5">
 | 
					    <div class="row py-5">
 | 
				
			||||||
        <mat-card *ngFor="let c of categories | async">
 | 
					        <ng-container *ngFor="let c of categories | async">
 | 
				
			||||||
            <img mat-card-image [src]="c.image | async" [alt]="c.name">
 | 
					            <mat-card *ngIf="c.ready">
 | 
				
			||||||
            <mat-divider class="custom-line"></mat-divider>
 | 
					                <img mat-card-image [src]="c.image | async" [alt]="c.name">
 | 
				
			||||||
            <mat-card-content>
 | 
					                <mat-divider class="custom-line"></mat-divider>
 | 
				
			||||||
                <h3>{{c.name}}</h3>
 | 
					                <mat-card-content>
 | 
				
			||||||
            </mat-card-content>
 | 
					                    <h3>{{c.name}}</h3>
 | 
				
			||||||
        </mat-card>
 | 
					                </mat-card-content>
 | 
				
			||||||
 | 
					            </mat-card>
 | 
				
			||||||
 | 
					        </ng-container>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
@@ -18,6 +18,7 @@ export class CategoriesComponent {
 | 
				
			|||||||
        map(rows =>
 | 
					        map(rows =>
 | 
				
			||||||
          rows.map((row: any) => {
 | 
					          rows.map((row: any) => {
 | 
				
			||||||
            row.image = this.storage.ref(`${row.name.toLowerCase()}.jpg`).getDownloadURL();
 | 
					            row.image = this.storage.ref(`${row.name.toLowerCase()}.jpg`).getDownloadURL();
 | 
				
			||||||
 | 
					            row.image.subscribe(() => (row.ready = true));
 | 
				
			||||||
            return row;
 | 
					            return row;
 | 
				
			||||||
          })
 | 
					          })
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user