当前位置: 首页 > 工具软件 > architect > 使用案例 >

Architecture overview

东郭良弼
2023-12-01

The basic building blocks of an Angular application are NgModules, which provide a compilation context for components. NgModules 

ngModeule是angualr应用基本构建模块,为组件提供了编译的上下文。ngModule

collect related code into functional sets; an Angular app is defined by a set of NgModules. An app always has at least a root module that 

把相关代码组成可运行集合,这些个ngModule的集合就是一个angualr app。一个angular应用至少有一个根模块

enables bootstrapping, and typically has many more feature modules.

,作为启动模块,通常还有很多特征模块。

  • Components define views, which are sets of screen elements that Angular can choose among and modify according to your program logic and data. Every app has at least a root component.

       组件定义了试图,angular可以在屏幕元素集合中选择,并可以依据自己项目逻辑和数据来修改。每个app至少有一个根组件。
  • Components use services, which provide specific functionality not directly related to views. Service providers can be injected into components as dependencies, making your code modular, reusable, and efficient.

        组件可以应用服务,服务是提供的特殊功能间接影响视图。服务提供者可以作为依赖注入到组件中,使你的代码更加模块化、可重用性和高效性。


Both components and services are simply classes, with decorators that mark their type and provide metadata that tells Angular how to use them.

组件和服务都是简单的类,包含了标记他们类型和提供元数据的声明,这些声明告诉angular怎么去使用他们。

  • The metadata for a component class associates it with a template that defines a view. A template combines ordinary HTML with Angular directives and binding markup that allow Angular to modify the HTML before rendering it for display.

    组件类的元数据和模块联系在一起共同定义视图,一个模块结合了普通的HTML和angualr指令,绑定了修饰使得angular可以在渲染视图之前改变HTML。
  • The metadata for a service class provides the information Angular needs to make it available to components through Dependency Injection (DI).

    服务类的元数据提供必要信息,使组件可以通过依赖注入来获取服务信息。


An app's components typically define many views, arranged hierarchically. Angular provides the Router service to help you define 

一个app组件通常定义很多视图,分层排列。angualr提供了路由服务来帮助你来

navigation paths among views. The router provides sophisticated in-browser navigational capabilities. 

定义这些视图的导航路径。路由提供复杂的浏览器导航功能实现。


angular的框架结构的几个主要概念,ngModule、component、metadata、service、views、template、directive、Dependency Injection、router。



 类似资料:

相关阅读

相关文章

相关问答