Tl;dr:
我刚读了这篇指南,介绍如何使用Angular Material,其中提到:
core.module
风格不再是官方的Angular Style Guide的一部分,但它似乎只是最近被删除。导入单例服务的新最佳实践是什么?为什么移除了该样式?
我刚读了这篇指南,介绍如何使用Angular Material,其中提到:
Then (as per the Angular Style Guide) I created a Core module
我查看了样式指南,但好像找不到这里引用的指南。在搜索过程中,我偶然发现了以下来源:
Nov. '18的博客文章介绍了core.module和shared.module之间的区别。
Oct. '17的这个问题有关于core.module的非常详细的解释。
Jul. '18的这个问题很不起眼。
最后一个问题涉及到使用core.module
样式,请点击此链接:
https://angular.io/guide/styleguide#core-feature-module
看起来 #core-feature-module
锚点已被删除,不再是 Angular 官方风格指南的一部分。只剩下 共享特性模块指南。
为什么删除了 core.module
指南?导入单例服务的最佳实践是什么?
core.module
风格与Angular ^2相关的内容,直到最近它似乎仍然是官方风格指南的一部分。我的问题仍然存在。 - codepearlex@Injectable()
装饰器的providedIn
选项使得core.module
风格变得无用,因为它仅适用于单例导入。然而,我最初阅读有关core.module
的博客文章建议在那里导入Angular Material。即使在core.module
仍被认为是最佳实践的时候,这似乎是一个错误的建议,因为Angular Material不是一个服务,而是一个组件集合。 - codepearlex