angular-promise-extras

WebJar for angular-promise-extras

License

License

ISC
Categories

Categories

Angular User Interface Web Frameworks
GroupId

GroupId

org.webjars.bower
ArtifactId

ArtifactId

angular-promise-extras
Last Version

Last Version

0.1.8
Release Date

Release Date

Type

Type

jar
Description

Description

angular-promise-extras
WebJar for angular-promise-extras
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/ohjames/angular-promise-extras

Download angular-promise-extras

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bower/angular-promise-extras/ -->
<dependency>
    <groupId>org.webjars.bower</groupId>
    <artifactId>angular-promise-extras</artifactId>
    <version>0.1.8</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bower/angular-promise-extras/
implementation 'org.webjars.bower:angular-promise-extras:0.1.8'
// https://jarcasting.com/artifacts/org.webjars.bower/angular-promise-extras/
implementation ("org.webjars.bower:angular-promise-extras:0.1.8")
'org.webjars.bower:angular-promise-extras:jar:0.1.8'
<dependency org="org.webjars.bower" name="angular-promise-extras" rev="0.1.8">
  <artifact name="angular-promise-extras" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bower', module='angular-promise-extras', version='0.1.8')
)
libraryDependencies += "org.webjars.bower" % "angular-promise-extras" % "0.1.8"
[org.webjars.bower/angular-promise-extras "0.1.8"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.bower : angular jar [1.3.0,1.7.0)

Project Modules

There are no modules declared in this project.

angular-promise-extras

build status

Installation

WebPack

  1. Install the package

    npm install --save angular-promise-extras
    
  2. require/import angular-promise-extras.

  3. Add the angular module ngPromiseExtras as a dependency of your application module.

Bower

  1. Install the package

    bower install --save angular-promise-extras
    
  2. Add the bower source file to your web page.

  3. Add the angular module ngPromiseExtras as a dependency of your application module.

Usage

var deferreds = [ $q.defer(), $q.defer() ]
var asyncVals = deferreds.map(function(deferred) {
  return deferred.promise
})
asyncVals.push(3)

$q.allSettled(asyncVals).then(function(values) {
  expect(values).toEqual([
    { state: 'fulfilled', value: 1 },
    { state: 'rejected', reason: 2 },
    { state: 'fulfilled', value: 3 },
  ])
})

deferreds[0].resolve(1)
deferreds[1].reject(2)

Also works with objects:

var deferreds = [ $q.defer(), $q.defer() ]
var promisesArray = deferreds.map(function(deferred) {
  return deferred.promise
})
var promises = { a: promisesArray[0], b: promisesArray[1], c: 3  }

$q.allSettled(promises).then(function(values) {
  expect(values).toEqual({
    a: { state: 'fulfilled', value: 1 },
    b: { state: 'rejected', reason: 2 },
    c: { state: 'fulfilled', value: 3 },
  })
})

deferreds[0].resolve(1)
deferreds[1].reject(2)

Also provides

  • $q.map: works like Bluebird.map or Bluebird.props depending on whether an array or an object is passed.
  • $q.mapSettled: Works like $q.map but with the settled semantics.
  • $q.resolve: Works like Bluebird.resolve.

Versions

Version
0.1.8
0.1.7