我的服务器按如下方式返回json,
search (term: string) {
this.eventService.getEventService().subscribe(events => {
console.log(events);
this.events = events;
}, error => this.errorMessage = error);
}
我将响应分配给名为events的数组,
<li *ngFor="let event of events | slice:0:4;let i=index" >
<span class="tab-content-area-active-location">
{{event.name}}
</span>
<span class="tab-content-area-active-location">
{{event.start_time}}
</span>
**</li>
我按如下方式绑定它,
Avril Lavigne in Sapporo, Japan 2016-12-19T00:00:00+0900
当前输出:**
Avril Lavigne in Sapporo Saturday, December 3, 2016, Camp Nou, Barcelona
预期输出:
{{1}}
答案 0 :(得分:2)
您可以使用竖线日期格式
(defun test (list)
(car list))
(test '(1 2 3)) ;; now returns 1
https://angular.io/docs/ts/latest/api/common/index/DatePipe-pipe.html