load compleate on search products compleate

This commit is contained in:
Eraldo Hasanaj
2019-02-10 16:52:09 +01:00
parent 1fcb838ba1
commit 87d4dcd7bb
2 changed files with 7 additions and 3 deletions

View File

@@ -13,7 +13,7 @@
</div>
<!-- [style.padding.px]="30" -->
<app-loading
loading="true"
loading="loading"
text="Inhalte werden geladen"
></app-loading>
</div>

View File

@@ -23,6 +23,7 @@ import { ProductMapping } from 'src/app/core/mappings/product.mapping';
export class SearchResultsComponent implements OnInit {
currentSearch: Search;
products: Product[];
loading = true;
@Select(ProcessState.getProducts) products$: Observable<ItemDTO[]>;
skip = 0;
@@ -30,7 +31,7 @@ export class SearchResultsComponent implements OnInit {
private store: Store,
private router: Router,
private productMapping: ProductMapping
) {}
) { }
ngOnInit() {
this.loadCurrentSearch();
@@ -67,6 +68,9 @@ export class SearchResultsComponent implements OnInit {
filter(f => Array.isArray(f)),
map(items => items.map(item => this.productMapping.fromItemDTO(item)))
)
.subscribe(data => (this.products = data));
.subscribe(
data => (this.products = data),
() => this.loading = false
);
}
}