gpt4 book ai didi

Angular:core.module 风格发生了什么变化?

转载 作者:行者123 更新时间:2023-12-03 14:48:34 25 4
gpt4 key购买 nike

Tl;博士 : 好像是core.module样式不再属于官方Angular Style Guide ,但它一定是最近才被删除的。导入单例服务的新最佳实践是什么,为什么删除了样式?

我刚看完 this Angular Material 入门指南及其说明

    Then (as per the Angular Style Guide) I created a Core module

我查了 Style Guide ,但似乎无法找到此处引用的指南。在我的搜索过程中,我偶然发现了以下来源:
  • A blogpost来自 2018 年 11 月 解释 core.module 和 shared.module 之间的区别。
  • This question来自 2017 年 10 月 对 core.module 有非常详细的解释。
  • This question来自 2018 年 7 月 ,这被忽视了。

  • 最后一个问题是指 core.module样式与此链接:
        https://angular.io/guide/styleguide#core-feature-module

    看来 #core-feature-module anchor 已被删除,不再是官方 Angular 风格指南的一部分。只有 shared feature module guideline遗迹。

    为什么是 core.module指南删除了?导入服务等单例的新最佳实践是什么?

    最佳答案

    嗯,简单说一下never been required :

    You may also completely remove the following files. They are AngularJS module configuration files and not needed in Angular:

    • app/app.module.ajs.ts
    • app/app.config.ts
    • app/core/core.module.ts
    • app/core/phone/phone.module.ts
    • app/phone-detail/phone-detail.module.ts
    • app/phone-list/phone-list.module.ts


    至于 reason why it got removed :

    @jenniferfell @brandonroberts fyi. @jenniferfell we removed CoreModule as a recommended technique because now the preferred way of providing services is using providedIn, however @bisonfoutu has a great point. I think the focus of this issue might be best suited for a style guide point on Feature Modules or SharedModule section, but I'd love to hear what the team and community have to say.

    IMO, where it could go were we to come to the conclusion that we should advise this technique: https://angular.io/guide/styleguide#shared-feature-module

    Thanks for filing this issue, @bisonfoutu!!

    Thoughts are welcome! ✨

    关于Angular:core.module 风格发生了什么变化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57606221/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com