Here is my json:
{ "data": [ { "comment": "3541", "datetime": "2016-01-01" } ] }
Here is the model:
export class Job { constructor(comment:string, datetime:Date) { this.comment = comment; this.datetime = datetime; } comment:string; datetime:Date; }
Query:
getJobs() { return this._http.get(jobsUrl) .map((response:Response) => <Job[]>response.json().data) }
The problem is that after casting to Job[] I expect the datetime property to be Date , but this is a string. Should I use a Date object? What am I missing here?
json angular typescript
Vladimir Nani Mar 10 '16 at 13:23 2016-03-10 13:23
source share