javascript - convert time stamp to Date inside angular expression like {{new Date(timestamp)}} -
Today I came to know that it is not converting an angular expression into a date.
So I just
& lt; Th & gt; {{New date (elem.timestamp}} but it fails with internal angular error.
So why is it not possible to put dates in angular expressions?
Because angular expressions do not accept arbitrary JavaScript code, which also includes new objects. It is called an angular filter, they were specially designed for this matter.
So this Instead of
{{new date (elem.timestamp)}}
you should
write <{elem .timestamp | Date: 'yyyy-MM -Did'}}
More information about the date filter can be found. Generally, more information about the filter can be found.
Comments
Post a Comment