I have implemented a filter in an ng-repeat to split a list of Jsons into two sub-lists: one for present-past items and the other for future items. The Json contains a key called "dateFrom," which I use to compare with the current date and determine in which list the item belongs.
However, even though the filter function only relies on the "dateFrom" key for this determination, if I make changes to other keys, the filter behavior also changes.
To demonstrate this issue, I created a quick jsFiddle:
https://jsfiddle.net/1j2p2hbg/1/
The filtering function looks like this:
$scope.isPast = function(item)
{
var now = new Date();
return (item.dateFrom <= now);
}
We have 4 elements in there... 3 with the current date and 1 with a future date. The "isPast" function strictly evaluates the "dateFrom" attribute, yet modifying "keyBoolOne" and "keyBoolTwo" can impact the filter results as well.
Could anyone shed some light on why this is happening?
Many thanks in advance!