angular 管道
2024-09-04 11:34:01
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({
name: 'multi'
})
export class MultiPipe implements PipeTransform { transform(value: any, args?: any): any {
if (args == null) {
args = ;
}
return value * args;
} }
<div>我的生日{{birth | date | uppercase}}</div>
<div>我的生日{{birth | date :'yyyy-MM-dd'}}</div>
<div>我的生日{{numberA | number :'2.1-4'}}</div> <div>我的生日{{numberA | multi :}}</div>
import { Component, OnInit } from '@angular/core'; @Component({
selector: 'app-bind',
templateUrl: './bind.component.html',
styleUrls: ['./bind.component.css']
})
export class BindComponent implements OnInit { private birth: Date; private numberA: number; constructor() { } ngOnInit() {
this.birth = new Date();
this.numberA = 3.1514926;
}
}
最新文章
- Kibana+Logstash+Elasticsearch 日志查询系统
- [Leetcode] Course Schedule
- HttpContextBase转换成HttpContext对象
- Mac 以太网连接 报无效的服务器地址 BasicIPv6ValidationError
- fork和exec一起使用
- HDU4945 2048(dp)
- linux下关于gz和bz2压缩格式的常用操作技巧
- 用Java编写你自己的简单HTTP服务器
- MySQL双主配置
- When to use DataContract and DataMember attributes?
- html5 canvas 画hello ketty
- C++ Builder中splitter控件的使用方法简介
- Java知识总结
- node.js平台下,利用cookie实现记住密码登陆(Express+Ejs+Mysql)
- iframe跨域动态设置主窗口宽高
- TJU ACM-ICPC Online Judge—1191 The Worm Turns
- EF开发中EntityFramework在web.config中的配置问题
- python+appium 自动化2--元素定位uiautomatorviewer
- Testlink1.9.17使用方法(第九章 测试结果分析)
- ORA-1652: unable to extend temp segment by 128 in tablespace xxx Troubleshootin