You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Solution:
Just send the value as parameter in the callback. It could even have 2 params: success and value (as angularjs callbacks have).
Real use-case:
In our application all messages that are being queued and displayed to the user in a messages-directive are being sent by the server within each structured response (may it be success or error). Our problem is that we have to write something like:
ajax.call($scope.shared.ajax.getXXX).then(
function (response) {
// ...
msgService.notify(response);
},
function (response) {
msgService.notify(response);
}
)
Instead of just
ajax.call($scope.shared.ajax.getXXX).then(
function (response) {
// ...
}
).finally(function(response) {
msgService.notify(response);
});
// OR JUST
ajax.call($scope.shared.ajax.getXXX)
.then(function (response) { // ... })
.finally(msgService.notify);
CONTEXT:
I am aware that Kris's initial implementation of $q (https://github.com/kriskowal/q) does not have this, but I still believe it's a very good idea to implement. I can contact Kris directly and discuss with him the option to include this in base implementation as well.