gpt4 book ai didi

angular - Angular 组件和模块有什么区别

转载 作者:太空狗 更新时间:2023-10-29 16:44:48 27 4
gpt4 key购买 nike

我一直在看视频和阅读文章,但这 specific article让我很困惑,在文章的开头它说

The applications in Angular follow modular structure. The Angular apps will contain many modules, each dedicated to the single purpose. Typically module is a cohesive group of code which is integrated with the other modules to run your Angular apps.

A module exports some classes, function and values from its code. The Component is a fundamental block of Angular and multiple components will make up your application.

A module can be a library for another module. For instance, the angular2/core library which is a primary Angular library module will be imported by another component.

它们是可交换的条款吗?组件是模块吗?但反之亦然?

最佳答案

组件控制 View (html)。它们还与其他组件和服务通信,为您的应用程序带来功能。

模块由一个或多个组件组成。他们不控制任何 html。您的模块声明哪些组件可以被属于其他 模块的组件使用,哪些类将由依赖注入(inject)器注入(inject),以及哪些组件被引导。模块允许您管理您的组件,为您的应用程序带来模块化。

关于angular - Angular 组件和模块有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40073941/

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