File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ function $Resolve( $q, $injector) {
42
42
visited [ key ] = VISIT_IN_PROGRESS ;
43
43
44
44
if ( isString ( value ) ) {
45
- plan . push ( key , [ function ( ) { return $injector . get ( key ) ; } ] , NO_DEPENDENCIES ) ;
45
+ plan . push ( key , [ function ( ) { return $injector . get ( value ) ; } ] , NO_DEPENDENCIES ) ;
46
46
} else {
47
47
var params = $injector . annotate ( value ) ;
48
48
forEach ( params , function ( param ) {
Original file line number Diff line number Diff line change @@ -3,6 +3,12 @@ describe("resolve", function () {
3
3
var $r , tick ;
4
4
5
5
beforeEach ( module ( 'ui.router.util' ) ) ;
6
+ beforeEach ( module ( function ( $provide ) {
7
+ $provide . factory ( 'Foo' , function ( ) {
8
+ return "Working" ;
9
+ } ) ;
10
+ } ) ) ;
11
+
6
12
beforeEach ( inject ( function ( $resolve , $q ) {
7
13
$r = $resolve ;
8
14
tick = $q . flush ;
@@ -292,6 +298,15 @@ describe("resolve", function () {
292
298
r ( { what : 'hi' } ) ;
293
299
expect ( trace ) . toEqual ( [ 'a: 1' , 'a: hi' ] ) ;
294
300
} ) ;
301
+
302
+ it ( "resolves values from string factory names" , function ( ) {
303
+ var result , r = $r . study ( { foo : "Foo" } ) ( ) . then ( function ( values ) {
304
+ result = values [ 'foo' ] ;
305
+ } ) ;
306
+ tick ( ) ;
307
+
308
+ expect ( result ) . toBe ( "Working" ) ;
309
+ } ) ;
295
310
} ) ;
296
311
} ) ;
297
312
You can’t perform that action at this time.
0 commit comments