File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 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) {
4242 visited [ key ] = VISIT_IN_PROGRESS ;
4343
4444 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 ) ;
4646 } else {
4747 var params = $injector . annotate ( value ) ;
4848 forEach ( params , function ( param ) {
Original file line number Diff line number Diff line change @@ -3,6 +3,12 @@ describe("resolve", function () {
33 var $r , tick ;
44
55 beforeEach ( module ( 'ui.router.util' ) ) ;
6+ beforeEach ( module ( function ( $provide ) {
7+ $provide . factory ( 'Foo' , function ( ) {
8+ return "Working" ;
9+ } ) ;
10+ } ) ) ;
11+
612 beforeEach ( inject ( function ( $resolve , $q ) {
713 $r = $resolve ;
814 tick = $q . flush ;
@@ -292,6 +298,15 @@ describe("resolve", function () {
292298 r ( { what : 'hi' } ) ;
293299 expect ( trace ) . toEqual ( [ 'a: 1' , 'a: hi' ] ) ;
294300 } ) ;
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+ } ) ;
295310 } ) ;
296311} ) ;
297312
You can’t perform that action at this time.
0 commit comments