Skip to content

Commit

Permalink
fix(view.load): Allow view.load to return synchronously
Browse files Browse the repository at this point in the history
- Wrap result in a promise
  • Loading branch information
christopherthielen committed Dec 3, 2016
1 parent 79260b6 commit 8619cf9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/hooks/views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ import {TransitionService} from "../transition/transitionService";
* In angular 1, this includes loading the templates.
*/
const loadEnteringViews: TransitionHookFn = (transition: Transition) => {
let $q = services.$q;
let enteringViews = transition.views("entering");
if (!enteringViews.length) return;
return services.$q.all(enteringViews.map(view => view.load())).then(noop);
return $q.all(enteringViews.map(view => $q.when(view.load()))).then(noop);
};

export const registerLoadEnteringViews = (transitionService: TransitionService) =>
Expand Down

0 comments on commit 8619cf9

Please sign in to comment.