angular基本知识学习笔记 - Component的基本概念
官網地址:https://angular.io/guide/architecture
Angular is a platform and framework for building single-page client applications using HTML and TypeScript. Angular is written in TypeScript. It implements core and optional functionality as a set of TypeScript libraries that you import into your apps.
平臺和框架,用于開發SPA應用,由TypeScript開發, 我們開發的應用導入Angular的TypeScript庫。
The architecture of an Angular application relies on certain fundamental concepts. The basic building blocks are NgModules, which provide a compilation context for components. NgModules 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 enables bootstrapping, and typically has many more feature modules.
Angular應用的基本組成部分是NgModules, 它是Component的編譯上下文。一個Angular應用至少包含一個Root module,用于實現BootStrap. 除了Root module外,Angular應用包含多個feature module.
Components define views, which are sets of screen elements that Angular can choose among and modify according to your program logic and data.
Component定義了視圖,是一系列screen element的集合。
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.
Component使用Service,service provider可以通過dependencies的方式被注入,讓Angular代碼更加模塊化,提供可重用性和執行效率。
Modules, components and services are classes that use decorators. These decorators mark their type and provide metadata that tells Angular how to use them.
Modules,Components和Services都是使用了Decorators的classes. 這些Decorators標記了三者的類型,提供了元數據,告知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.
Component類的metadata將其關聯到了一個模板上,該模板定義了一個視圖。此模板將普通的html同Angular的directive和綁定信息的Markup結合了起來,允許Angular在HTML渲染顯示之前動態地修改它。
The metadata for a service class provides the information Angular needs to make it available to components through dependency injection (DI).
Service Class的metadata給Angular提供了足夠的用于依賴注入的信息。
Components定義了若干Views,通過Router service進行navigation管理。
總結
以上是生活随笔為你收集整理的angular基本知识学习笔记 - Component的基本概念的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 中软国际推出新款工业中控屏:15 英寸
- 下一篇: 评论:ChatGPT情商很高,但并不适合