This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Interpolation of Date object produces quoted ISO string (v1.4.4). #14027
Closed
Description
Building a directive that takes a date string for an attribute. If bound to a Date object, the interpolated value passed to the $observe/$watch function is an ISO string surrounded by double quotes.
Markup:
<my-directive today="{{selectedDate}}"/>
link method:
attrs.$observe('today', function(val) { opts.today = new Date(val); });
Value of 'val' received in function and viewed in console looks like:
""2016-02-12T22:59:26.630Z""
This can be resolved with opts.today = new Date(eval(val))
but it would be necessary to see if someone actually supplied a static string date for the attribute instead of a bound object by checking for a leading quote.
Is this working as designed or is it a bug?