<div style="text-align:center">
  <h1>
    Welcome to {{ title }}!
  </h1>
  <p>{{today | date:'yyyy-MM-dd HH:mm:ss' }}</p>
  <p>{{num | number:'1.2-4'}}</p> <!--/接收的参数格式为{最少整数位数}.{最少小数位数}-{最多小数位数} -->
  <p>{{num | number:'1.2-2'}}</p> 
  <p>{{num | number:'1.1-1'}}</p> 
  <p>{{{ "name": "semlinker" }| json }}</p> <!-- Output: { "name": "semlinker" } -->
  <p>{{userinfo| json }}</p> 
  
</div>
import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  title = 'angulardemo';
  public today=new Date();
  num=12.123456;
  userinfo:any={
    name:' 张三',
    age:24
  };
}

 

 效果图:

angular 管道_f5


 

http://bbs.loaderman.com/topic/5bf519657e9f5911d41f2a34