Skip to content
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

@SimplGy

Description

@SimplGy

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions