SamVerschueren / angular2-polyfill

Angular2 polyfill for Angular1
MIT License
29 stars 3 forks source link

OpaqueToken should generate unique tokens #53

Closed SamVerschueren closed 8 years ago

SamVerschueren commented 8 years ago

Currently, OpaqueToken is not implemented correctly because it does not generate unique tokens. The DI system of ng1 works with strings in this library is using the toString() method of the OpaqueToken object as identifier which is not unique.

new OpaqueToken('foo').toString() === new OpaqueToken('foo').toString()
// true

In order to fix this, it should keep track of a unique index (static property) which should be attached in the toString() method.