Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

Ionic 2 Login With Parse API - Context Problem THIS - returns different class within success and error functions

$
0
0

You can also use the bind function to bind the context to a specific reference. I find generating a self variable to be a bit of a hack and can still cause problems when your callbacks are calling other callbacks. In the case of the presented code, it would look something like:

success: function(user) {
          // Do stuff after successful login.
         this.nav.push(TabsPage); // HERE I WANT TO REDIRECT TO THE LOGGED IN PAGES OF MY APP
    }.bind(this)

I think the current best practice though is the lambda (fat-arrow) notation you were suggesting.


Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>