An SVG snippet template needs an svg:
prefix on its root element to disambiguate the SVG element from an HTML component.
模板中的 SVG 片段需要给它的根元素加上svg:
前缀,以便把 SVG 元素和 HTML 元素区分开。
<svg>
<rect x="0" y="0" width="100" height="100"/>
</svg>
An <svg>
root element is detected as an SVG element automatically, without the prefix.
以<svg>
作为根元素时会自动识别为 SVG 元素,不需要前缀。
Built-in directives 内置指令 |
|
---|---|
| Removes or recreates a portion of the DOM tree based on the 根据 |
| Turns the li element and its contents into a template, and uses that to instantiate a view for each item in list. 把 li 元素及其内容变成一个模板,并使用这个模板为列表中的每一个条目实例化一个视图。 |
| Conditionally swaps the contents of the div by selecting one of the embedded templates based on the current value of 根据 |
| Binds the presence of CSS classes on the element to the truthiness of the associated map values. The right-hand expression should return {class-name: true/false} map. 根据 map 中的 value 是否为真,来决定该元素上是否出现与 name 对应的 CSS 类。右侧的表达式应该返回一个形如 |
| Allows you to assign styles to an HTML element using CSS. You can use CSS directly, as in the first example, or you can call a method from the component. 允许你使用 CSS 为 HTML 元素指定样式。你可以像第一个例子那样直接使用 CSS,也可以调用组件中的方法。 |
Forms 表单 |
|
---|---|
| Provides two-way data-binding, parsing, and validation for form controls. 为表单控件提供双向数据绑定、解析和验证功能。 |
Class decorators 类装饰器 |
|
---|---|
| Declares that a class is a component and provides metadata about the component. 声明一个类是组件,并提供该组件的元数据。 |
| Declares that a class is a directive and provides metadata about the directive. 声明一个类是指令,并提供该指令的元数据。 |
| Declares that a class is a pipe and provides metadata about the pipe. 声明一个类是管道,并提供该管道的元数据。 |
| Declares that a class has dependencies that should be injected into the constructor when the dependency injector is creating an instance of this class. 声明某个类具有一些依赖。当依赖注入器要创建这个类的实例时,应该把这些依赖注入到它的构造函数中。 |
Directive configuration 指令配置项 |
|
---|---|
| Specifies a CSS selector that identifies this directive within a template. Supported selectors include 指定一个 CSS 选择器,用于在模板中标记出该指令。支持的选择器类型包括: Does not support parent-child relationship selectors. 但不支持指定父子关系的选择器。 |
| List of dependency injection providers for this directive and its children. 该指令及其子指令的依赖注入提供商列表。 |
Component configuration 组件配置项 | |
---|---|
| If set, the 如果设置了,那么 |
| List of dependency injection providers scoped to this component's view. 依赖注入提供商列表,但它们的范围被限定为当前组件的视图。 |
| Inline template or external template URL of the component's view. 当前组件视图的内联模板或外部模板的 URL 。 |
| List of inline CSS styles or external stylesheet URLs for styling the component’s view. 用于为当前组件的视图提供样式的内联 CSS 或外部样式表 URL 的列表。 |
Class field decorators for directives and components 给指令和组件使用的类属性配置项 |
|
---|---|
| Declares an input property that you can update via property binding (example: 声明一个输入属性,你可以通过属性绑定来更新它,如 |
| Declares an output property that fires events that you can subscribe to with an event binding (example: 声明一个输出属性,它发出事件,你可以用事件绑定来订阅它们(如: |
| Binds a host element property (here, the CSS class 把宿主元素的一个属性(这里是 CSS 类 |
| Subscribes to a host element event ( 用指令或组件上的 |
| Binds the first result of the component content query ( 把组件内容查询( |
| Binds the results of the component content query ( 把组件内容查询( |
| Binds the first result of the component view query ( 把组件视图查询( |
| Binds the results of the component view query ( 把组件视图查询( |
Directive and component change detection and lifecycle hooks 指令与组件的变更检测与生命周期钩子 | (implemented as class methods) 由类的方法实现。 |
---|---|
| Called before any other lifecycle hook. Use it to inject dependencies, but avoid any serious work here. 在任何其它生命周期钩子之前调用。可以用它来注入依赖项,但不要在这里做正事。 |
| Called after every change to input properties and before processing content or child views. 每当输入属性发生变化时就会调用,但位于处理内容( |
| Called after the constructor, initializing input properties, and the first call to 在调用完构造函数、初始化完所有输入属性并首次调用过 |
| Called every time that the input properties of a component or a directive are checked. Use it to extend change detection by performing a custom check. 每当对组件或指令的输入属性进行变更检测时就会调用。可以用它来扩展变更检测逻辑,执行自定义的检测逻辑。 |
| Called after
|
| Called after every check of the component's or directive's content. 每当组件或指令的内容( |
| Called after 当 |
| Called after every check of the component's views and child views / the view that a directive is in. 当组件的视图及其子视图或指令所属的视图每次执行变更检测时调用。 |
| Called once, before the instance is destroyed. 只在实例被销毁前调用一次。 |
Dependency injection configuration 依赖注入配置项 | |
---|---|
| Sets or overrides the provider for 把 |
| Sets or overrides the provider for 把 |
| Sets or overrides the provider for 把 |
Routing and navigation 路由与导航 |
|
---|---|
| Configures routes for the application. Supports static, parameterized, redirect, and wildcard routes. Also supports custom route data and resolve. 为该应用配置路由。支持静态、参数化、重定向和通配符路由。也支持自定义路由数据和解析(resolve)函数。 |
| Marks the location to load the component of the active route. 标记出一个位置,用来加载活动路由的组件。 |
| Creates a link to a different view based on a route instruction consisting of a route path, required and optional parameters, query parameters, and a fragment. To navigate to a root route, use the 使用路由体系创建一个到其它视图的链接。路由体系由路由路径、必要参数、可选参数、查询参数和文档片段组成。要导航到根路由,请使用 |
| The provided classes are added to the element when the 当 |
| An interface for defining a class that the router should call first to determine if it should activate this component. Should return a boolean or an Observable/Promise that resolves to a boolean. 用来定义类的接口。路由器会首先调用本接口来决定是否激活该路由。应该返回一个 |
| An interface for defining a class that the router should call first to determine if it should deactivate this component after a navigation. Should return a boolean or an Observable/Promise that resolves to a boolean. 用来定义类的接口。路由器会在导航离开前首先调用本接口以决定是否取消激活本路由。应该返回一个 |
| An interface for defining a class that the router should call first to determine if it should activate the child route. Should return a boolean or an Observable/Promise that resolves to a boolean. 用来定义类的接口。路由器会首先调用本接口来决定是否激活一个子路由。应该返回一个 |
| An interface for defining a class that the router should call first to resolve route data before rendering the route. Should return a value or an Observable/Promise that resolves to a value. 用来定义类的接口。路由器会在渲染该路由之前,首先调用它来解析路由数据。应该返回一个值或能解析成值的 |
| An interface for defining a class that the router should call first to check if the lazy loaded module should be loaded. Should return a boolean or an Observable/Promise that resolves to a boolean. 用来定义类的接口。路由器会首先调用它来决定是否应该加载一个惰性加载模块。应该返回一个 |