Angular 2 内置管道
示例
Angular2带有一些内置管道:
还有其他在这里查看其文档。
示例
hotel-reservation.component.ts
import { Component } from '@angular/core';
@Component({
moduleId: module.id,
selector: 'hotel-reservation',
templateUrl: './hotel-reservation.template.html'
})
export class HotelReservationComponent {
public fName: string = 'Joe';
public lName: string = 'SCHMO';
public reservationMade: string = '2016-06-22T07:18-08:00'
public reservationFor: string = '2025-11-14';
public cost: number = 99.99;
}hotel-reservation.template.html
<div>
<h1>Welcome back {{fName | uppercase}} {{lName | lowercase}}</h1>
<p>
On {reservationMade | date} at {reservationMade | date:'shortTime'} you
reserved room 205 for {reservationDate | date} for a total cost of
{cost | currency}.
</p>
</div>输出结果Welcome back JOE schmo On Jun 26, 2016 at 7:18 you reserved room 205 for Nov 14, 2025 for a total cost of $99.99.
热门推荐
10 迟到的过年祝福语简短
11 车位销售祝福语简短精辟
12 婚礼父母在家祝福语简短
13 韩语学生毕业祝福语简短
14 对学姐的简短祝福语
15 运动社团祝福语简短英文
16 老婆生日祝福语短句简短
17 香薰的寓意祝福语简短
18 生日祝福语古语简短创意