w88优德2--pipe管道运用

日期:2018-11-29 / 人气: / 来源:[db:来源]

  官网地址(华语):https://w88优德.cn/docs/ts/latest/guide/pipes.html

  官网地址(华语):https://w88优德.io/docs/ts/latest/guide/pipes.html

  Pipe

  Usage

  Example

  将输入值,依照壹个map到来替换,露示婚配值

  用法:

  管道却以多级(链式)

  官网伸见:

  What it does

  Unwraps a value from an asynchronous primitive.

  How to use

  observable_or_promise_expression | async

  NgModule

  CommonModule

  Description

  The async pipe subscribes to an Observable or Promise and returns the latest value it has emitted. When a new value is emitted, the async pipe marks the component to be checked for changes. When the component gets destroyed, the async pipe unsubscribes automatically to avoid potential memory leaks.

  Examples

  This example binds a Promise to the view. Clicking the Resolve button resolves the promise.

  It’s also possible to use async with Observables. The example below binds the time Observable to the view. The Observable continuously updates the view with the current time.

  到来己:http://stackoverflow.com/users/3708596/everettss 的案例

  Becomes:

  Use case scenario:

  A table view consists of different columns with different data format that needs to be transformed with different pipes.

  到来己http://stackoverflow.com/users/871956/borislemke

  table.component.ts

  dynamic.pipe.ts

  table.component.html

  Result

  管道写成了module

  文思:写成module,运用imports带入。运用的时分,假设参数度过多,先替换为json程式,在当做参数传入我们己建的管道。

  运用

  ts文件

  模板文件

作者:[db:作者]


  • 友情链接:
  • 澳门金沙官网
  • 日博
  • 365体育在线手机版
  • 新2足球网址
  • 澳门新葡京官网
  • Go To Top 回顶部