首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

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管理。

下一篇
举报
领券