简体   繁体   中英

What type of Class Decorator to use for a non-GUI Class in Angular 2?

I want to take advantage of Object Oriented principles and group my code into classes. However, my classes frequently have dependencies on either @angular libraries or services that I have created.

Using the new operator is out because many libraries fail without the DI framework.

What is the proper way to make a plain old class that depends on @angular libraries?

也许可以肯定地说,如果我根据@angular依赖项计划一个类,我应该只使用@Injectable()并将其创建为服务吗?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM