File tree 2 files changed +17
-0
lines changed
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -540,6 +540,8 @@ angular.module('ui.bootstrap.modal', [])
540
540
angular . forEach ( resolves , function ( value ) {
541
541
if ( angular . isFunction ( value ) || angular . isArray ( value ) ) {
542
542
promisesArr . push ( $q . when ( $injector . invoke ( value ) ) ) ;
543
+ } else if ( angular . isString ( value ) ) {
544
+ promisesArr . push ( $q . when ( $injector . get ( value ) ) ) ;
543
545
}
544
546
} ) ;
545
547
return promisesArr ;
Original file line number Diff line number Diff line change @@ -523,6 +523,21 @@ describe('$modal', function () {
523
523
expect ( $document ) . toHaveModalOpenWithContent ( 'Content from resolve' , 'div' ) ;
524
524
} ) ;
525
525
526
+ it ( 'should resolve string references to injectables' , function ( ) {
527
+ open ( {
528
+ controller : function ( $scope , $foo ) {
529
+ $scope . value = 'Content from resolve' ;
530
+ expect ( $foo ) . toBe ( $modal ) ;
531
+ } ,
532
+ resolve : {
533
+ $foo : '$modal'
534
+ } ,
535
+ template : '<div>{{value}}</div>'
536
+ } ) ;
537
+
538
+ expect ( $document ) . toHaveModalOpenWithContent ( 'Content from resolve' , 'div' ) ;
539
+ } ) ;
540
+
526
541
it ( 'should delay showing modal if one of the resolves is a promise' , function ( ) {
527
542
528
543
open ( modalDefinition ( '<div>{{value}}</div>' , {
You can’t perform that action at this time.
0 commit comments