Angular核心模块的作用是什么? [英] What is the role of Angular core module?

查看:58
本文介绍了Angular核心模块的作用是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了文章关于在Angular中组织文件夹,作者使用了一个叫做 core 的代码,他在其中创建核心模块并仅插入将被调用一次的服务.

I read an article about organizing folders in Angular and the author uses one called core, in which he creates the core module and insert only services which will be called once.

当前,我正在一个项目上,因此我采用了文章.在我的 core 文件夹/模块内,我创建了一个名为 api 的模块:

Currently, I'm working on a project whereupon I adopted the structure recommended by the article. Inside my core folder/module I created a module called api:

\app
  \core
    \api
    ...
  \shared
  ...

我的问题是:由于 api 是一个模块,我想知道为什么不从 core 中将其删除并放入 app 文件夹中?

My question is: as the api is a module, I was wondering why not remove it from core and put in app folder?

\app
  \api
  \core
  \shared
  ...

Angular本身也有 core 模块(我们在其中导入 ngModule Injectable ...),我想知道什么是它的作用.

Angular itself has core module too (where we import ngModule, Injectable...) and I'd like to know what is its role.

推荐答案

您的 CoreModule 包含用于实例化您的应用程序和加载某些核心功能的代码.

Your CoreModule contains code that will be used to instantiate your app and load some core functionality.

要了解更多信息,请阅读 核心模块

To get more idea on this read Core Module

这篇关于Angular核心模块的作用是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆