0

Searching into Angular 2.0 source code (@angular/core": "2.0.0-rc.4) I found that first it contains two provider.d.ts definitions this is one aspect but other aspect is that all the classes in this provider.d.ts files and a lot of properties are marked as @deprecated.

node_modules\@angular\core\src\di\provider.d.ts

node_modules\@angular\core\esm\src\di\provider.d.ts

I was looking on how to use Angular 2.0 DI outside of Angular Components. Since Angular 2.0 is in quite advanced state(Release Candidate) most of the API should be already stable with some minor changes possibly coming. Still all of this classes related in DI are marked as deprecated. In the same time all tutorials and examples in internet are with classes from this provider.d.ts files my question is. What this @deprecated flag means and should I use the API's in this provider.d.ts files or not ?

4

1 回答 1

2

因为添加非原始提供程序的新方法是对象字面量语法,例如

providers: [MyMockClass, {provide: MyClass, useExisting: MyMockClass}]

useValue, useFactory, useClass,multi也是除 之外支持的参数useExisting

于 2016-07-26T13:19:35.923 回答