How to use then() in Ionic2?


#1

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


#2

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);
    }
);