Just beginning my journey with Angular js,
I've got this snippet of code that is responsible for binding data to the div element,
app.filter("myfilter", function () {
return function (data, catName) {
if (angular.isArray(data) && angular.isString(catName)) {
var rs = [];
var key = {};
for (var i = 0; i < data.length; i++) {
var currdata = data[i][catName];
if (angular.isUndefined(key[currdata])) {
key[currdata] = true;
rs.push(currdata);
}
}
return rs;
}
else
return data;
}
})
While reviewing the code above, I came across a line "key[currdata] = true;" Can anyone explain what this line of code does?
If I comment out this particular line, the data binding process doesn't work. Any insights would be appreciated.
Thank you in advance.