How to use then() in Ionic2?

If i want to nav.push(somepage) after the process of localstorage finishing. How should i do?

I think it’s a promise, so it would look something like this:

storage.set('something').then(
    (result) => {
        // all good, lets move on
        this.nav.push(somepage);
    },
    (err) => {
        // something didn't work
       console.log(err);
    }
);
1 Like