Minor fixes

This commit is contained in:
Zakary Timson 2018-08-08 01:26:21 -04:00
parent 58837c5218
commit 5724d9fcca
2 changed files with 9 additions and 8 deletions

View File

@ -5,7 +5,7 @@
<div class="row">
<div class="col-12 col-md-3">
<slideshow [autoPlay]="true" [imageUrls]="preview" [height]="'300px'"></slideshow>
<div *ngIf="links.length">
<div *ngIf="links?.length">
<h5 class="mt-3 mb-0 pl-3">Links</h5>
<mat-list>
<mat-list-item *ngFor="let l of links">
@ -21,7 +21,7 @@
<mat-divider class="my-3"></mat-divider>
<p style="overflow: hidden;" [innerHtml]="product.description"></p>
<mat-divider class="my-3"></mat-divider>
<div *ngIf="attachments.length">
<div *ngIf="attachments?.length">
<h5 class="ml-3">
<mat-icon style="vertical-align: bottom;">cloud_download</mat-icon> Downloads
</h5>

View File

@ -29,12 +29,13 @@ export class ProductsComponent {
this.product = data[0];
this.preview = [this.product.originalImage];
this.preview = this.preview.concat(
this.product.files.filter(row => row.type == 'preview').map(row => row.link)
);
this.links = this.product.files.filter(row => row.type == 'link');
this.attachments = this.product.files.filter(row => row.type == 'other');
if (this.product.files) {
this.preview = this.preview.concat(
this.product.files.filter(row => row.type == 'preview').map(row => row.link)
);
this.links = this.product.files.filter(row => row.type == 'link');
this.attachments = this.product.files.filter(row => row.type == 'other');
}
});
});
}