Ionic serve browser refresh

Hello,

Please can somebody help me fix this frustrating issue, if it is possible. Every time I save my file in the text editor whilst ionic serve is running the browser refreshes and loads the changes but it goes back to the home page each time so I then need to navigate to the page I am trying to watch change.

Thanks

I think so too…

I try 2 way.
One is change rootPage for working. for example, during I write about.html, I change app.ts.

this.rootPage = AboutPage;

Another, I make one URL(hash). and set auto nav.push custom pages.

@Injectable()
export class Helper
{
public get_articleId(hash)
{
if ( hash.indexOf(’#/article/’) == -1) {
return false;
}
let articleID = hash.replace( β€œ#/article/” , β€œβ€ );

   if(articleID){
       return articleID;
   }else{
       return false;
   }

}
}

In Component.

ngOnInit()
{
let articleId = this.helper.get_articleId(window.location.hash);
if(articleId){
this.nav.push(ArticleDetail,{id:articleId});
}
}

regards.

1 Like

Thanks for the reply that is a great idea changing the root I will do that - the other way is a bit harder for me but also looks good. I wonder if it is something to do with the new way that Gulp watches SCSS files as in Ionic 1 it was a bit different.

1 Like

Another way needs nav use argument.
for example

this.nav.push(<any>HogePage,{
  userId  : userId,
});

Regards.