Unable to navigate in succes callback of rest call


Hi there,

I am fairly new to ionic and seem to be stuck with a basic issue.

I have a rest call which comes back successfully. The console logs in this succes callback execute without problems. But i want to navigate to another page. For this i use this.navCtrl.push(PhotoOverviewPage);

The funny parts is when i comment the rest call and just execute the navctrl function it works fine. But within a success callback it does nothing. I don’t get any errors or warnings.

Does work


Does not work

   this.loginService.doLogin(this.url, this.username, this.password).then(function(data: any){
      console.log("Login came back with data: ");

Maybe i am just missing something.
Thanks in advance,


Never type the word “function” inside the body of one. Use an arrow function instead. You are losing execution context.