JSFiddle - React, Tailwind, and code Playground

HTML

<div ng-repeat="node in modules | searchFor:searchString track by $index">
    <md-card>
        {{node.name}}
    </md-card>
 </div>

JavaScript

angular.module("test")
.filter('searchFor', function ($translate) {
var nest = function (seq, keys) {
            if (!keys.length)
                return seq;
            var first = keys[0];
            var rest = keys.slice(1);
            return _.mapValues(_.groupBy(seq, first), function (value) {
                return nest(value, rest)
            });
        };
return function (arr, searchString,AND_OR) {
            if (!searchString) {
                return arr;
            }
            var result = [];
                angular.forEach(arr, function (module) {
											//code here to search in every levels of modules(partitions,usecases)
                      //and returns nodes as shown in the question here 
											// http://stackoverflow.com/questions/38682613/infinite-loops-caused-by-ng-repeat-and-search-filter-results
											//the 'result' array has filled here
								});
            
            //return result;// this returns correct results without grouping
            
            //here function for grouping the result
            var nested = nest(result, ['grandpa','parent']);
            return nested;
            
})
.controller(function(.....){
    $scope.modules="modules": {
        "UserManagement": {
            "id":0,
            "name": "UserManagement",
            "parent":"modules",
            "grandpa":"non",
            "viewname":"User Management",
            "level":"module",
            "template": "UserManagement",
            "keywords":"user management users manager managing ",
            "description":"module UserManagement My goal is simple. It is a complete understanding of the universe, why it is as it is and why it exists at all . Stephen Hawking",
            "partitions":{
                "UsersRoles": {
                    "id":1,
                    "name": "UsersRoles",
                    "viewname":"Users Roles",
                    "level":"partition",
                   ...