christopherthielen / ui-router-extras

THIS PROJECT IS NO LONGER MAINTAINED -- Extras for UI-Router for AngularJS. Sticky States (a.k.a. parallel states), Deep State Redirect (for tab-like navigation), Future States (async state definition)
http://christopherthielen.github.io/ui-router-extras/
MIT License
917 stars 211 forks source link

$futureStateProvider -- top-level future, abstract states not supported #277

Closed laurelnaiad closed 8 years ago

laurelnaiad commented 8 years ago
TypeError: Cannot read property 'source' of undefined
    at _futureStateProvider.futureState (http://localhost:3000/jspm_packages/npm/ui-router-extras@0.1.0/release/modular/ct-ui-router-extras.future.js:72:46)

The line that is tripping it up is https://github.com/christopherthielen/ui-router-extras/blob/master/src/future.js#L61.

      if (realParent) {
        parentMatcher = realParent.url || realParent.navigable && realParent.navigable.url;
      } else if (parentName === "") {
        parentMatcher = $urlMatcherFactory.compile("");
      } else {
        var futureParent = findState((futureState.parent || parentName), true);
        if (!futureParent) throw new Error("Couldn't determine parent state of future state. FutureState:" + angular.toJson(futureState));
        // there is no urlMatcher property on the futureParent because everything above the futureState is abstract
        var pattern = futureParent.urlMatcher.source.replace(/\*rest$/, "");
        parentMatcher = $urlMatcherFactory.compile(pattern);
        futureState.parentFutureState = futureParent;
      }

This is happening because the top two states in my hierarchy are abstract. I have a patch that I'll submit as a PR.