Impliment change detection
This commit is contained in:
@@ -6,6 +6,7 @@ import { Title } from '@angular/platform-browser';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Authentication } from '../../../services/Authentication';
|
||||
import { Product } from 'app/models/Product';
|
||||
import { ChangeDetectorRef } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'catalog',
|
||||
@@ -17,7 +18,7 @@ export class CatalogComponent {
|
||||
|
||||
public Products: Product[] = [];
|
||||
|
||||
constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, public auth: Authentication ) {
|
||||
constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, public auth: Authentication, private cdr: ChangeDetectorRef ) {
|
||||
this.title.setTitle("Store | Mistox");
|
||||
|
||||
// load each product
|
||||
@@ -30,6 +31,7 @@ export class CatalogComponent {
|
||||
item.images.forEach(img => {
|
||||
http.get("https://mistox.com/api/productimage/get?ProductID=" + img.productID + "&ImageID=" + img.imageID, { responseType: 'blob' }).subscribe(blob => {
|
||||
img.imageSrc = blob;
|
||||
this.cdr.detectChanges();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user