p.location-badge.
exported from angular2/di
defined in angular2/src/di/exceptions.ts (line 69)
:markdown
Thrown when trying to retrieve an async Binding
using the sync API.
## Example
```javascript
var injector = Injector.resolveAndCreate([
bind(Number).toAsyncFactory(() => {
return new Promise((resolve) => resolve(1 + 2));
}),
bind(String).toFactory((v) => { return "Value: " + v; }, [String])
]);
injector.asyncGet(String).then((v) => expect(v).toBe('Value: 3'));
expect(() => {
injector.get(String);
}).toThrowError(AsycBindingError);
```
The above example throws because `String` depends on `Number` which is async. If any binding in
the dependency graph is async then the graph can only be retrieved using the `asyncGet` API.
.l-main-section
h2 Members
.l-sub-section
h3 constructor
pre.prettyprint
code.
constructor(key)
:markdown