Skip to content

Instantly share code, notes, and snippets.

@almaron
Last active August 29, 2015 14:02
Show Gist options
  • Save almaron/77da9ce65cb2679d35f5 to your computer and use it in GitHub Desktop.
Save almaron/77da9ce65cb2679d35f5 to your computer and use it in GitHub Desktop.
app.filter("filterTree", [
"$filter", function($filter) {
return function(tree) {
var newTree = [];
angular.forEach(tree, function(node, index) {
var newNode;
newNode = {
id: node.id,
sort_order: index,
children: $filter('filterTree')(node.children)
};
newTree.push(newNode);
});
return newTree;
};
}
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment