【发布时间】:2016-06-15 17:46:36
【问题描述】:
我正在使用date 管道来格式化我的日期,但如果没有解决方法,我无法获得我想要的确切格式。我是错误地理解管道还是不可能?
//our root app component
import {Component} from 'angular2/core'
@Component({
selector: 'my-app',
providers: [],
template: `
<div>
<h2>Hello {{name}}</h2>
<h3>{{date | date: 'ddMMyyyy'}}, should be
{{date | date: 'dd'}}/{{date | date:'MM'}}/{{date | date: 'yyyy'}}</h3>
</div>
`,
directives: []
})
export class App {
constructor() {
this.name = 'Angular2'
this.date = new Date();
}
}
【问题讨论】:
-
date管道目前有几个问题。 -
这个候选版本仍然感觉有点未完成。这是我在 2 天内偶然发现的第二个问题。希望他们能尽快解决。为此创建自己的管道是一种选择,但感觉有点像重复..您可以在几个月内将其删除..
标签: date angular angular-pipe date-pipe