angular-cn/public/docs/js/latest/api/di/CyclicDependencyError-class.jade

38 lines
673 B
Plaintext
Raw Normal View History

2015-04-19 13:53:18 -07:00
2015-04-22 08:06:51 -07:00
p.location-badge.
2015-06-01 22:51:00 -07:00
exported from <a href='../di'>angular2/di</a>
defined in <a href="https://github.com/angular/angular/tree/master/modules/angular2/src/di/exceptions.ts#L103-L130">angular2/src/di/exceptions.ts (line 103)</a>
2015-04-19 13:53:18 -07:00
:markdown
2015-04-20 13:57:43 -07:00
Thrown when dependencies form a cycle.
2015-04-19 13:53:18 -07:00
## Example:
```javascript
class A {
constructor(b:B) {}
}
class B {
constructor(a:A) {}
}
```
2015-04-20 13:57:43 -07:00
Retrieving `A` or `B` throws a `CyclicDependencyError` as the graph above cannot be constructed.
2015-04-19 13:53:18 -07:00
.l-main-section
h2 Members
.l-sub-section
h3 constructor
pre.prettyprint
code.
2015-04-20 13:57:43 -07:00
constructor(key)
2015-04-19 13:53:18 -07:00
:markdown
2015-06-01 22:51:00 -07:00
2015-04-19 13:53:18 -07:00