This repository was archived by the owner on May 29, 2019. It is now read-only.
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 @@ -538,6 +538,8 @@ angular.module('ui.bootstrap.modal', [])
538
538
angular . forEach ( resolves , function ( value ) {
539
539
if ( angular . isFunction ( value ) || angular . isArray ( value ) ) {
540
540
promisesArr . push ( $q . when ( $injector . invoke ( value ) ) ) ;
541
+ } else if ( angular . isString ( value ) ) {
542
+ promisesArr . push ( $q . when ( $injector . get ( value ) ) ) ;
541
543
}
542
544
} ) ;
543
545
return promisesArr ;
Original file line number Diff line number Diff line change @@ -547,6 +547,21 @@ describe('$modal', function () {
547
547
expect ( $document ) . toHaveModalOpenWithContent ( 'Content from resolve' , 'div' ) ;
548
548
} ) ;
549
549
550
+ it ( 'should resolve string references to injectables' , function ( ) {
551
+ open ( {
552
+ controller : function ( $scope , $foo ) {
553
+ $scope . value = 'Content from resolve' ;
554
+ expect ( $foo ) . toBe ( $modal ) ;
555
+ } ,
556
+ resolve : {
557
+ $foo : '$modal'
558
+ } ,
559
+ template : '<div>{{value}}</div>'
560
+ } ) ;
561
+
562
+ expect ( $document ) . toHaveModalOpenWithContent ( 'Content from resolve' , 'div' ) ;
563
+ } ) ;
564
+
550
565
it ( 'should delay showing modal if one of the resolves is a promise' , function ( ) {
551
566
552
567
open ( modalDefinition ( '<div>{{value}}</div>' , {
You can’t perform that action at this time.
0 commit comments