Skip to content

Commit

Permalink
fix(ngzone): httpnatif media page
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoblanc committed Aug 14, 2019
1 parent b956210 commit b584c58
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/app/media/media.page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { Component, OnInit, ViewChild, NgZone } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { StyleService } from '../provider/style.service';
import { MetaMedia } from '../models/meta-media/meta-media';
Expand Down Expand Up @@ -39,10 +39,11 @@ export class MediaPage implements OnInit {

currentMedia: MetaMedia;
constructor(private route: ActivatedRoute,
public contentService: ContentService<IContent>,
public metaMediaService: MetaMediaService,
public styleService: StyleService,
public statusBar: StatusBar) {
public contentService: ContentService<IContent>,
public metaMediaService: MetaMediaService,
public styleService: StyleService,
public statusBar: StatusBar,
private zone: NgZone) {

}

Expand Down Expand Up @@ -73,11 +74,15 @@ export class MediaPage implements OnInit {
this.contentService.getContents()
.subscribe((page: Page<IContent>) => {
// Affectation des données serveur dans notre variable local
this.page = page;
this.loading = false;
this.zone.run(() => {
this.page = page;
this.loading = false;
});
}, (error) => {
console.error(error);
this.loading = false;
this.zone.run(() => {
console.error(error);
this.loading = false;
});
});
}

Expand Down

0 comments on commit b584c58

Please sign in to comment.