Comments (5)
@mohanrao I ran into this problem as well. As @christopherthielen mentioned it's because of ui-router-core is loaded twice. See this notice in angular-ui-router.js.
NOTICE: This monolithic bundle also bundles the @uirouter/core code.
* This causes it to be incompatible with plugins that depend on @uirouter/core.
* We recommend switching to the ui-router-core.js and ui-router-angularjs.js bundles instead.
* For more information, see http://ui-router.github.io/blog/angular-ui-router-umd-bundles
I know you released bower components for ui-router-core and ui-router-sticky states in this other issue. If you look closely at the files in bower_components/angular-ui-router/release, you'll notice ui-router-angular.js is included. So the last thing you need to do is add to bower.json's overrides section to change the main file loaded by angular-ui-router. This is where you would define the dependencies as well. For my purposes, I made it require both core and sticky-states.
"overrides": {
"angular-ui-router": {
"main": [
"release/ui-router-angularjs.js"
],
"dependencies": {
"angular":">= 1.2.0",
"ui-router-core": "*",
"ui-router-sticky-states": "*"
}
}
}
from sticky-states.
@cloudmark thanks for the very detailed bug and instructions. It really helped me track this one down.
I switched the sticky states onCreate
hook to a higher priority. Now it processes the treeChanges
first, then lets ui-router-core
add the coreResolvables
such as the Transition
object.
I'd also like to clear up some confusion, for posterity:
As soon as you run the code the first error shows up, this is due to a refactor in ui-router-core:
Note: Don't know if you would prefer if I report this as a separate bug in the ui-router-core project.
This was actually due to a problem with the published UMD bundles of ui-router-ng2. We were including all the code from ui-router-core
in the UMD bundle, and pointing the package.json main:
entry to the bundle. Since you're bundling the es5 code, you got the ui-router-ng2.js
file which includes all the code from ui-router-core
. However, since sticky states also imports from ui-router-core
, it was adding the core code TWICE to your project. This caused the instanceof
checks to fail, since some of the PathNode objects came from ui-router-ng2.js
and some of them came from ui-router-core
.
Unfortunately, the fix involves releasing a new ui-router-ng2 which does not bundle the ui-router-core code in its UMD bundle. This also means you have to add an entry in your systemjs config file for the ui-router-core
entry point.
(subPath should not include the current node)
subPath
should include the nodes from root up to and including the node being searched for.
In ui-router-core 3.0.0, the Transition
token was added after the onCreate
hooks. In ui-router-core 4.0+, it is added by https://github.com/ui-router/core/blob/master/src/hooks/coreResolvables.ts. ui-router-ng2 1.0.0-beta.4 uses ui-router-core 4.0.0.
I've released sticky-states 1.2.0 which depends on ui-router-core 3.x-4.x. I'll be releasing 1.3.0 soon which depends on ui-router-core ^5.0.0 and updates to the new apis
from sticky-states.
I am seeing same issue with angular-ui-router 1.0.4 , @uirouter/sticky-states v1.4.1 and @uirouter/core v5.0.4
I am using loading the js in the order of angular-ui-router , uirouter core and sticky-state.
from sticky-states.
Thanks @mevludin90 . I forgot put the notes on this issue. I figured out the same. And did the same in my bower.json
from sticky-states.
My project ran into the same issue after I installed @uirouter/core
manually by the command yarn add @uirouter/core --dev
, which actually upgrade the version to 5.0.6
.
But everything works ok on release @uirouter/[email protected]
. So I degrade dependencies...
$ npm ls | grep router
├── @uirouter/[email protected]
├─┬ @uirouter/[email protected]
├─┬ [email protected]
│ └── @uirouter/[email protected]
from sticky-states.
Related Issues (20)
- OnRetain not called
- Sticky state resetting issue HOT 2
- Stuck sticky states HOT 1
- exitSticky typings issue HOT 1
- UI-router uiOnParamsChanged event is not triggered when StickyStatesPlugin is enabled HOT 3
- toggle show sub-views like TAB behavior
- Trouble using angularjs + npm + scripts solution HOT 1
- Action required: Greenkeeper could not be activated 🚨
- Action required: Greenkeeper could not be activated 🚨
- How to setup "sticky-states" with views HOT 11
- Using sticky-states, the destruction function is not triggered when the page is refreshed HOT 1
- Sticky states + "orphan" state + onExit = transition error HOT 3
- Error with sticky-states and chromium 40 HOT 2
- Sticky States v1.5.0 throws error in IE 11 (Object doesn't support property or method 'find') HOT 2
- Check to see if sticky state is loaded? HOT 2
- Import required even when `exitSticky` property (on `TransitionOptions`) needs to be used. HOT 1
- Load sticky state if non-sticky state was loaded from server HOT 1
- Not able to navigate back HOT 1
- How to deactivate existing sticky state HOT 1
- How to use pamas in sticky state HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sticky-states.