Giter Club home page Giter Club logo

Comments (5)

mevludin90 avatar mevludin90 commented on July 16, 2024 1

@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.

christopherthielen avatar christopherthielen commented on July 16, 2024

@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.

mohanrao avatar mohanrao commented on July 16, 2024

@christopherthielen

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.

mohanrao avatar mohanrao commented on July 16, 2024

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.

cesiya23 avatar cesiya23 commented on July 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.