Commit Graph

24 Commits

Author SHA1 Message Date
vsavkin f210c41c1f feat(di): changed toFactory to support dependency annotations 2015-05-21 08:34:48 -07:00
Misko Hevery 1eea2b254e feat: allow for forward references in injection
It is possible for a class defined first to be referencing a class defined later,
and as a result at the time of the definition it is not possible to access the later's
class reference. This allows to refer to the later defined class through
a closure.Closes #1891
2015-05-15 21:12:57 -07:00
yjbanov 358a6750ed feat(di): support type literals in DI 2015-05-12 10:57:53 -07:00
yjbanov 2185e7cee9 feat(di): expose parent injector 2015-05-08 17:11:27 -07:00
vsavkin cb87fa0970 chore(build): migrated di to TypeScript 2015-05-06 19:00:56 -07:00
Rado Kirov 457c15cd6c feat(decorators): adds decorator versions of DI annotations.
In 'angular2/di' the symbol:
- Inject is a decorator
- InjectAnnotation is an annotation

Internally one an get a hold of annotations without *Annotations appened
(to make ts2dart work without workarounds) by importing from
'angular2/src/di/annotations_impl' instead of 'angular2/di'. This is
needed only for users that transpile through TS and through ts2dart.
2015-05-04 13:35:09 -07:00
Pawel Kozlowski ee1b574baf fix(di): improve error messages for invalid bindings
Fixes #1515

Closes #1573
2015-04-28 23:42:36 +00:00
Pawel Kozlowski e23004df52 fix(di): capture original exception in InvalidBindingError
Fixes #1406

Closes #1459
2015-04-21 10:59:44 +02:00
Misko Hevery 87ac100c66 docs: add DI to public docs 2015-04-17 03:56:17 +00:00
vsavkin 97fc248e00 cleanup(di): changed an error message to be more descriptive 2015-04-16 11:06:20 -07:00
Kevin Moore 957384ceeb fix: Fix issues found by Dart analyzer 2015-04-15 20:58:29 -07:00
Yegor Jbanov 308823b6ea perf(view): use pre-resolved bindings for child injector init
Creating a child injector from pre-resolved bindings (if any) is an
order of magnitude faster.
2015-04-13 15:06:44 -07:00
Yegor Jbanov 4a961f4ecb feat(di): provide two ways to create an injector, resolved and unresolved
Add two factory static functions to Injector: resolveAndCreate and
fromResolvedBindings.

We want to avoid resolution and flattening every time we create a new
injector. This commit allows the user to cache resolved bindings and
reuse them.
2015-04-13 15:06:43 -07:00
Yegor Jbanov 6c8398df9b fix(di): refactor bindings to support Dart annotations 2015-04-13 15:06:43 -07:00
vsavkin ee36aaf163 fix(tests): fixed a broken test 2015-03-26 07:46:26 -07:00
Victor Berchet 3ec837bfdb test(di): Add a test for sync binding + resolved async dependency 2015-03-26 08:38:29 +01:00
Victor Berchet 33b5ba863e feat(tests): add a test injector
fixes #614

Asynchronous test should inject an AsyncTestCompleter:

Before:

  it("async test", (done) => {
    // ...
    done();
  });

After:

  it("async test", inject([AsyncTestCompleter], (async) => {
    // ...
    async.done();
  }));

Note: inject() is currently a function and the first parameter is the
array of DI tokens to inject as the test function parameters. This
construct is linked to Traceur limitations. The planned syntax is:

  it("async test", @Inject (async: AsyncTestCompleter) => {
    // ...
    async.done();
  });
2015-03-13 18:20:02 +01:00
Victor Berchet a82e20889d feat(Injector): Support binding to null 2015-03-12 19:52:08 +01:00
vsavkin ba0a1ec459 feat(di): add support for optional dependencies 2015-03-02 14:38:02 -08:00
Yegor Jbanov 757eae8ad3 feat(compiler): DOM adapters + html5lib implementation; misc fixes 2015-02-27 16:49:14 -08:00
Pawel Kozlowski 0c4fbfc8e2 feat(di): introduce aliasing
Closes #710
Closes #747
2015-02-21 18:43:45 +01:00
vsavkin fa7cbf9bb1 test(di): add a test to di checking that child bindings are not used when resolving the dependencies of a parent binding 2015-02-06 09:39:22 -08:00
Yegor Jbanov 3f228669d7 chore(packaging): update import for the new file structure 2015-02-05 15:47:12 -08:00
Yegor Jbanov 3820609f24 chore(packaging): move files to match target file structure 2015-02-05 15:46:13 -08:00