Skip to content

Commit

Permalink
fix(lazyLoad): Wait for future state to be replaced before registerin…
Browse files Browse the repository at this point in the history
…g lazy children

Closes #46
Closes #40
Closes angular-ui/ui-router#3375
  • Loading branch information
christopherthielen committed Mar 27, 2017
1 parent 8b47c9d commit 4bdce47
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/state/stateBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,10 @@ export class StateBuilder {
build(state: StateObject): StateObject {
let {matcher, builders} = this;
let parent = this.parentName(state);
if (parent && !matcher.find(parent)) return null;

if (parent && !matcher.find(parent, undefined, false)) {
return null;
}

for (let key in builders) {
if (!builders.hasOwnProperty(key)) continue;
Expand Down
4 changes: 2 additions & 2 deletions src/state/stateMatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class StateMatcher {
}


find(stateOrName: StateOrName, base?: StateOrName): StateObject {
find(stateOrName: StateOrName, base?: StateOrName, matchGlob = true): StateObject {
if (!stateOrName && stateOrName !== "") return undefined;
let isStr = isString(stateOrName);
let name: string = isStr ? stateOrName : (<any>stateOrName).name;
Expand All @@ -23,7 +23,7 @@ export class StateMatcher {

if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) {
return state;
} else if (isStr) {
} else if (isStr && matchGlob) {
let _states = values(this._states);
let matches = _states.filter(state =>
state.__stateObjectCache.nameGlob &&
Expand Down

0 comments on commit 4bdce47

Please sign in to comment.