组件:
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-pipe',
templateUrl: './pipe.component.html',
styleUrls: ['./pipe.component.css']
})
export class PipeComponent implements OnInit {
date=new Date();
money=5.9372;
object={title:'ffff',subTitle:'subtitlefff'};
str='abcdABCD';
percent=0.97989;
constructor() { }
ngOnInit() {
}
}
模板:
<p>
{{date| date:'y-MM-dd HH:mm:ss'}} <br />
{{object| json }} <br />
{{str| uppercase }} <br />
{{str| lowercase }} <br />
{{money| number:'2.4-10' }} <br />
{{money| number:'5.1-2' }} <br />
{{money| currency:'CNY':false:'1.1-2' }} <br />
{{percent| percent:'1.1-2' }} <br />
{{str| slice:1:3 }} <br />
{{'female'| sexReform }} <br />
</p>
更多关于AngularJS相关内容感兴趣的读者可查看本站专题:《AngularJS指令操作技巧总结》、《AngularJS入门与进阶教程》及《AngularJS MVC架构总结》
希望本文所述对大家AngularJS程序设计有所帮助。
