Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

chore($q): change when to resolve #15442

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/app/src/examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ angular.module('examples', [])

ctrl.prepareExampleData = function() {
if (ctrl.example.manifest) {
return $q.when(ctrl.example);
return $q.resolve(ctrl.example);
}

return getExampleData(ctrl.examplePath).then(function(data) {
Expand Down
10 changes: 5 additions & 5 deletions docs/content/guide/component-router.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ You can see the complete application running below.


function HeroService($q) {
var heroesPromise = $q.when([
var heroesPromise = $q.resolve([
{ id: 11, name: 'Mr. Nice' },
{ id: 12, name: 'Narco' },
{ id: 13, name: 'Bombasto' },
Expand Down Expand Up @@ -308,7 +308,7 @@ You can see the complete application running below.


function CrisisService($q) {
var crisesPromise = $q.when([
var crisesPromise = $q.resolve([
{id: 1, name: 'Princess Held Captive'},
{id: 2, name: 'Dragon Burning Cities'},
{id: 3, name: 'Giant Asteroid Heading For Earth'},
Expand Down Expand Up @@ -415,7 +415,7 @@ You can see the complete application running below.

function DialogService($q) {
this.confirm = function(message) {
return $q.when(window.confirm(message || 'Is it OK?'));
return $q.resolve(window.confirm(message || 'Is it OK?'));
};
}
</file>
Expand Down Expand Up @@ -714,7 +714,7 @@ making an actual server request, perhaps over HTTP.

```js
function HeroService($q) {
var heroesPromise = $q.when([
var heroesPromise = $q.resolve([
{ id: 11, name: 'Mr. Nice' },
...
]);
Expand Down Expand Up @@ -991,7 +991,7 @@ have made. The result of the prompt is a promise that can be used in a `$routerC

function DialogService($q) {
this.confirm = function(message) {
return $q.when(window.confirm(message || 'Is it OK?'));
return $q.resolve(window.confirm(message || 'Is it OK?'));
};
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/content/guide/forms.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ In the following example we create two directives:

if (ctrl.$isEmpty(modelValue)) {
// consider empty model valid
return $q.when();
return $q.resolve();
}

var def = $q.defer();
Expand Down
2 changes: 1 addition & 1 deletion src/ng/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ function $HttpProvider() {

var requestInterceptors = [];
var responseInterceptors = [];
var promise = $q.when(config);
var promise = $q.resolve(config);

// apply interceptors
forEach(reversedInterceptors, function(interceptor) {
Expand Down
4 changes: 2 additions & 2 deletions test/ng/httpSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('$http', function() {
return {
requestError: function(error) {
savedConfig.url += error;
return $q.when(savedConfig);
return $q.resolve(savedConfig);
}
};
});
Expand Down Expand Up @@ -269,7 +269,7 @@ describe('$http', function() {
$provide.factory('myInterceptor', function($q, $rootScope) {
return {
request: function(config) {
return $q.when('/intercepted').then(function(intercepted) {
return $q.resolve('/intercepted').then(function(intercepted) {
config.url = intercepted;
return config;
});
Expand Down
2 changes: 1 addition & 1 deletion test/ngAnimate/animationSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ describe('$$animation', function() {
$$animationProvider.drivers[0] = 'dumbDriver';
$provide.factory('dumbDriver', function($q) {
return function stepFn() {
return $q.when(true);
return $q.resolve(true);
};
});
});
Expand Down