Promise.all ([ tuti,tuti2] ) firing once


#1


i tried this tutorial to get markers added on the map everything’s working fine but
when i navigate to other pages and then return to map page markers don’t appear ,only the first time need help …
i’m using menu to navigate through pages i tried everyhting even putting the method in the constructor and tried all the functions :
ionViewDidLoad() ,ionViewWillLoad(),ionViewDidEnter()…i’m helpless right now !! this is my method:

 ionViewDidLoad(){
       this.platform.ready().then(() => {
            let mapLoaded = this.maps.init(this.mapElement.nativeElement,
              this.pleaseConnect.nativeElement);
            let locationsLoaded = this.load();
        Promise.all([
            mapLoaded,
            locationsLoaded,
            ]).then((result) => {
        if(result){
           let locations = result[1];
                for(let location of locations){
                  this.maps.addMarker(location);
                 }
        this.maps.addMyPosition();     
               });  
    });
 }

#2

Maybe ionViewWillEnter? Or does it need to be reloaded?

Then have you try to debug or put some console.log(‘here something etc.’); to see where it goes when you do the back action?

Do you have a public repo to share?


#3

Morony’s blog is very good, but perhaps every example I’ve seen has an issue: it breaks if you port it into a PWA. His code is designed as bite-size pieces that fit into a single-page web app. This isn’t a criticism. He needs to keep his posts short. But you need to be more sophisticated to make things work than you might have realized.

Be clear with yourself on this. Are you designing (1) a single-page app, or (2) a “traditional” desktop browser experience? Choice (2) is much harder to code in Ionic than choice (1). If you’re doing (1) and you still have this problem, the fix is probably not difficult.


#4

no i haven’t sharea repo …
i’m still trying …i’ll let u know if i find a solution