This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +22
-0
lines changed
2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -497,6 +497,19 @@ function qFactory(nextTick, exceptionHandler) {
497
497
return result . promise . then ( callback , errback , progressBack ) ;
498
498
} ;
499
499
500
+ /**
501
+ * @ngdoc method
502
+ * @name $q#resolve
503
+ * @kind function
504
+ *
505
+ * @description
506
+ * Alias of {@link ng.$q#when when} to maintain naming consistency with ES6.
507
+ *
508
+ * @param {* } value Value or a promise
509
+ * @returns {Promise } Returns a promise of the passed value or promise
510
+ */
511
+ var resolve = when ;
512
+
500
513
/**
501
514
* @ngdoc method
502
515
* @name $q#all
@@ -565,6 +578,7 @@ function qFactory(nextTick, exceptionHandler) {
565
578
$Q . defer = defer ;
566
579
$Q . reject = reject ;
567
580
$Q . when = when ;
581
+ $Q . resolve = resolve ;
568
582
$Q . all = all ;
569
583
570
584
return $Q ;
Original file line number Diff line number Diff line change @@ -1643,6 +1643,14 @@ describe('q', function() {
1643
1643
} ) ;
1644
1644
1645
1645
1646
+ describe ( 'resolve' , function ( ) {
1647
+ it ( 'should be an alias of the "when" function' , function ( ) {
1648
+ expect ( q . resolve ) . toBeDefined ( ) ;
1649
+ expect ( q . resolve ) . toEqual ( q . when ) ;
1650
+ } ) ;
1651
+ } ) ;
1652
+
1653
+
1646
1654
describe ( 'optional callbacks' , function ( ) {
1647
1655
it ( 'should not require success callback and propagate resolution' , function ( ) {
1648
1656
q . when ( 'hi' , null , error ( ) ) . then ( success ( 2 ) , error ( ) ) ;
You can’t perform that action at this time.
0 commit comments