Unable to handle the promise of $state.reload

I have ran into a scenario where when user refreshes the browser, the variable should be set to false.

My Code :

let showVar = true;
if(this.$state.reload(this.$state.current.name)){
            showVar = false;
        }

Right now its working. But i can see that $state.reload returns a promise and not sure how to handle that. Any help is appreciated. Thanks in advance.

Upvotes: 0

Views: 117

Answers (1)

Dhirendra
Dhirendra

Reputation: 790

What you are trying to do is

let showVar = true;
this.$state.reload(this.$state.current.name).then(() => {
    showVar = false;
});

Upvotes: 1

Related Questions