Nav.present not found


#1

Hi everyone,

I got these problems with the last version of ionic2 with typescript and after two days of research i post here :

First one :

as you can see, the function present of nav is not found, i dont see why : there is my code (pretty simple) :
http://pastebin.com/QDGCnWEF

Second problem :
In the pastebin (in onLoginSuccess and onLoginFail), i must use LoginPage.prototype.showAlert to use this function, why cant i just use this.showAlert directly ? (when i do that, i got a this.showAlert is not a function).

Thanks for your help !

EDIT : i forgot the info :

Your system information:

Cordova CLI: 6.0.0
Ionic Version: 2.0.0-beta.2
Ionic CLI Version: 2.0.0-beta.19
Ionic App Lib Version: 2.0.0-beta.9
OS: Windows 7 SP1
Node Version: v4.2.3


#2

You should change:

nav: any;

to:

nav:NavController

In fact you could have private nav:NavController in your constructor and take out the above line all together.

e.g

constructor(
    private nav: NavController
  ) {
}

#3

If you base your code on what’s done here in the Conference app it should work.


#5

Hi sorry,

You are right for the parameter in constructor but the problem dont come from here.

After further more research i was interested in the context that my code was executed, and i was right.
‘this’ in the callback code isnt refered as LoginPage but (maybe) as HttpService :

http://pastebin.com/SLH5Utku

I just need to pass the instance of nav and my function will be correctly code.

Thanks for you’r awser btw :slight_smile:

EDIT : dunno how to archive the post for someone to search the same problem as me ?