I have an angularjs ng-class function I am trying to use to set my table row color. I am fairly new to both angular and js so my error is most likely user error. I am trying to check if a date field is null / undefined then trying to set the row color accordingly, but I am getting a parse error on the date. Do I need to do something different with my date?
Thanks!
html setting row color:
<tr data-ng-repeat="s in data.sites" data-ng-class="setRowConditional({{s.LastScanReceived}})">
AngularJS controller function:
//Set row color
$scope.setRowConditional = function (lastScanReceived) {
var recDate = Date.parse(lastScanReceived);
if (typeof recDate === 'undefined') {
return "danger";
}
else {
return "active";
};
}
Parse Error:
Error: [$parse:syntax] Syntax Error: Token 'T13' is unexpected, expecting [)] at column 29 of the expression [setRowConditional(2013-12-18T13:59:09.397)] starting at [T13:59:09.397)].