angular-hybrid icon indicating copy to clipboard operation
angular-hybrid copied to clipboard

uiSref not working in an angular component

Open vzorge opened this issue 6 years ago • 0 comments

Hello,

I am not sure if I should ask this here on on the angular repository. But since I am using angular-hybrid I will ask it here.

The following line in the construction of UIsref is throwing an error for me: this._statesSub = _router.globals.states$.subscribe(function () { return _this.update(); });

I have tried to trace this in the code. What I found was a bit confusing, which is why I am posting this question.

When I debug, I see that the router.globals is defined as follows: globals: {, $current: {..}, $get: {...}, current: {..}, lastStatedTransitionId: 0, params: {...}, successfulTransitions: {...}, transition: null, transitionHistory: {...}

When I look at the source, this matches UIRouterGlobals from @angular-ui/core perfectly. So I was wondering why it was even assumed there would be a states$ variable on here. I did find where it comes from, the interface in @uirouter/core/lib/globals of ui-router/rx.

I don't quite have the knowledge to know what I did wrong here. I can post my whole setup, but if someone can help me understand how those globals.states$ is supposed to be set, I can try to figure out a minimal reproduction.

Edit: Ok, right after I typed this I found a solution. If I add the following to me bootstrapping, it no longer throws the error: uiRouter.plugin(UIRouterRx);

Not sure why this is mandatory and if it is, why it is not listed in the Readme. Therefor leaving this issue open for now.

vzorge avatar May 17 '19 08:05 vzorge