angular 管道

<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
  };
}

 

 效果图:


 

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

 

posted on 2019-05-20 16:42  LoaderMan  阅读(1107)  评论(0编辑  收藏  举报

导航