unique filter broken with multi-word parameters?
Hello, I have JSON data that includes multi-word parameters. When I try the unique filter in my ng-repeat I get the error that the second word in the parameter is an unexpected token.
Does the unique filter support multi-word keys/parameters? I've tried wrapping in single quotes, double curly braces to no avail.
(in the following, histConfig.column is a scope variable referring to a multi-word key in importedData) ng-repeat="row in importedData | uniq:histConfig.column"
error msg: Error: [$parse:syntax] Syntax Error: Token 'Provider' is an unexpected token at column 11 of the expression [Referring Provider] starting at [Provider].
Copied in the following for a custom filter and it worked fine. Maybe a problem with parsing multiword keys?
return function (arr, field) {
var o = {}, i, l = arr.length, r = [];
for(i=0; i<l;i+=1) {
o[arr[i][field]] = arr[i];
}
for(i in o) {
r.push(o[i]);
}
return r;
perfect to me thanks kanethal . I create new filter and use your code. Work fine!