Instead of
.then(function (res) {
element.width(oldWidth); // restore size
attr.$set('disabled', false);
spinner.stop();
return res;
}, function (res) {
element.width(oldWidth); // restore size
attr.$set('disabled', false);
spinner.stop();
});
you can use:
.finally(function() {
element.width(oldWidth); // restore size
attrs.$set('disabled', false);
spinner.stop();
});
for a more DRY approach.
Instead of
you can use:
for a more DRY approach.