我在项目 Spring 中使用 Java 8 日期时间,但是当我显示该日期时,我有:[object Object]
服务器 :
class Person {
LocalDateTime dateCreation;
...
}
和
@RestController
public class PersonController {
@RequestMapping(value ="/getPerson", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public List<A> getPerson() {
return personRepository.findAll();
}
....
客户 :
ngOnInit() {
this.PersonService.getPersons().subscribe(persons => this.persons = persons);
}
和
export class Person {
....
dateCreation:Date;
}
和 person.html :
<p-dataTable [value]="persons" ...>
<p-column field="dateCreation" header="DateCreation" [sortable]="true">
<template let-col let-person="rowData" pTemplate="body">
{{person.dateCreation|date}}
</template>
</p-column>