This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
1.3 makes $q's deferred.promise methods non-enumerable, breaks angular.extend #9933
Closed
Description
Recently upgraded from 1.2 to 1.3.1.
In 1.3, promise methods are on the prototype. They didn't used to be in 1.2.
In 1.2, This plunker shows I can extend with a promise.
In 1.3, This plunker shows I can no longer extend with a promise.
This means those methods are not enumerable any more. angular.extend
only moves enumerable properties, which is sensible.
Extending an object with a promise may seem like an odd idea, but a modal is a neat use case:
Modal = function(contents) {
// ...
this.deferred = $q.defer();
angular.extend(this, this.deferred.promise);
return this;
}
warningModal = new Modal('Are you sure?');
warningModal.then(continueWithDeleting);
Metadata
Metadata
Assignees
Labels
No labels