简体   繁体   English

ProvidedIn:Angular 14+ 中的“any”已弃用。 什么是好的替代品?

[英]ProvidedIn: 'any' in Angular 14+ is deprecated. What would be a good replacement?

According to Angular Official Documentation for Angular 14+, any is depreciated:根据Angular 官方文档Angular 14+, any折旧:

any': Provides a unique instance in each lazy loaded module while all eagerly loaded modules share one instance. any':在每个延迟加载的模块中提供一个唯一的实例,而所有急切加载的模块共享一个实例。 This option is DEPRECATED.此选项已弃用。

I haven't found anything on the web. What would be a good replacement for it?我在 web 上没有找到任何东西。有什么可以很好地替代它?

You should be using root instead of any or NgModule .您应该使用 root 而不是anyNgModule Those two have next to no use cases and are most likely used incorrectly.这两个几乎没有用例,很可能使用不当。 You can read further here: Angular - Update Angular to v15您可以在此处进一步阅读: Angular - 将 Angular 更新到 v15

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Angular 中的 DefaultIterableDiffer 已弃用。 我现在该怎么办? - DefaultIterableDiffer in Angular is deprecated. What shall I do now? v14 中 Angular 编译器的替代品是什么? - What is the replacement for the Angular Compiler in v14? Observable `of` 已弃用。 什么是等价物? - Observable `of` deprecated. What is the equivalent? providedIn any 和 root 有什么区别 - What is the difference between providedIn any and root Angular中如何将非独立组件导入独立组件 14+ - How to import not standalone components to a standalone component in Angular 14+ Angular Typescript错误-不推荐使用字符集。 (弃用) - Angular Typescript Error - charset is deprecated. (deprecation) Angular 14 - 什么方法是最佳编码实践 angular 组件 - Angular 14 - what method would be best coding practice angular components 提供Angular 7服务:'root' - Angular 7 Service providedIn: 'root' 如果在 2 个延迟加载模块中使用了 Angular 服务,则为providedIn 设置什么 - What to set for providedIn, if Angular service is used in 2 lazy loaded modules 在 Angular 6 中生成服务时,提供 Injectable 装饰器的目的是什么? - What is the purpose of providedIn with the Injectable decorator when generating Services in Angular 6?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM