From f7c729fb98510ab87ef9580346900b2ba08a6f9d Mon Sep 17 00:00:00 2001 From: Alejandro Sanchez Betancourt Date: Sat, 6 Sep 2014 20:19:04 -0500 Subject: [PATCH] Added support for object key with spaces This fix adds support to filter JSON data that contains keys names with spaces, and avoids runtime errors. as $parse is needed no more, i removed it. --- src/_filter/collection/group-by.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/_filter/collection/group-by.js b/src/_filter/collection/group-by.js index 868285a..8848675 100644 --- a/src/_filter/collection/group-by.js +++ b/src/_filter/collection/group-by.js @@ -10,11 +10,10 @@ angular.module('a8m.group-by', [ 'a8m.filter-watcher' ]) - .filter('groupBy', [ '$parse', 'filterWatcher', function ( $parse, filterWatcher ) { + .filter('groupBy', [ 'filterWatcher', function ( filterWatcher ) { return function (collection, property) { var result, - get = $parse(property), prop; if(!isObject(collection) || isUndefined(property)) { @@ -25,7 +24,7 @@ angular.module('a8m.group-by', [ 'a8m.filter-watcher' ]) result = filterWatcher.$watch('groupBy', collection); forEach( collection, function( elm ) { - prop = get(elm); + prop = elm[property]; if(!result[prop]) { result[prop] = [];