@@ -606,16 +606,7 @@ function $RouteProvider() {
606
606
}
607
607
608
608
$q . when ( nextRoute ) .
609
- then ( function ( ) {
610
- if ( nextRoute ) {
611
- var locals = resolveLocalsFor ( nextRoute ) ;
612
- var template = getTemplateFor ( nextRoute ) ;
613
- if ( angular . isDefined ( template ) ) {
614
- locals [ '$template' ] = template ;
615
- }
616
- return $q . all ( locals ) ;
617
- }
618
- } ) .
609
+ then ( resolveLocals ) .
619
610
then ( function ( locals ) {
620
611
// after route change
621
612
if ( nextRoute === $route . current ) {
@@ -633,14 +624,20 @@ function $RouteProvider() {
633
624
}
634
625
}
635
626
636
- function resolveLocalsFor ( route ) {
637
- var locals = angular . extend ( { } , route . resolve ) ;
638
- angular . forEach ( locals , function ( value , key ) {
639
- locals [ key ] = angular . isString ( value ) ?
640
- $injector . get ( value ) :
641
- $injector . invoke ( value , null , null , key ) ;
642
- } ) ;
643
- return locals ;
627
+ function resolveLocals ( route ) {
628
+ if ( route ) {
629
+ var locals = angular . extend ( { } , route . resolve ) ;
630
+ angular . forEach ( locals , function ( value , key ) {
631
+ locals [ key ] = angular . isString ( value ) ?
632
+ $injector . get ( value ) :
633
+ $injector . invoke ( value , null , null , key ) ;
634
+ } ) ;
635
+ var template = getTemplateFor ( route ) ;
636
+ if ( angular . isDefined ( template ) ) {
637
+ locals [ '$template' ] = template ;
638
+ }
639
+ return $q . all ( locals ) ;
640
+ }
644
641
}
645
642
646
643
0 commit comments