Angular 1 - subscribe in the state.resolve function


#1

Hello,

I’d like to make sure that my page loads after the data is available. UI-Router has a mechanism just for that: resolve. However, I’m not clear on how to avoid double subscription: first time in resolve function. Second - in the component’s controller associated with the state.

The reason I think I need to subscribe in both locations is that controller’s subscribe function will pass watch a property and feed appropriate data based on that property:

this.subscribe('mySubscription', ()=> [this.getReactively('terms')]);

Notice that that terms is the property under controller of the component and is not available in the resolve of ui-router.