查看: 51|回复: 0

angular 管道

[复制链接]

0

主题

0

回帖

0

积分

积极分子

金币
0
阅读权限
220
精华
0
威望
0
贡献
0
在线时间
0 小时
注册时间
2011-3-10
发表于 2019-5-20 16:42:00 | 显示全部楼层 |阅读模式
<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

 

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

相关侵权、举报、投诉及建议等,请发 E-mail:qiongdian@foxmail.com

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部