JSFiddle - React, Tailwind, and code Playground

by walker

HTML

<div ng-app>
    <div ng-controller="demoCtrl">
        {{sample}}
    </div>
</div>

JavaScript

function demoCtrl($scope){
		var extendDeep = function(dst) {
		  angular.forEach(arguments, function(obj) {
		    if (obj !== dst) {
		      angular.forEach(obj, function(value, key) {
	        	if(angular.isObject(dst[key]) || angular.isArray(dst[key])){
		          extendDeep(dst[key], value);
		        } else {
		          dst[key] = angular.copy(value);
		        }     
		      });   
		    }
		  });
		  return dst;
		};
    
    $scope.sample = {
        "a":11,
        "b":22,
        "c":[
            {
                "more":"more",
                "m":33,
                "items":[
                    {
                        "a":0,
                        "b":0,
                        "c":"hello"
                    },
                    {
                        "a":0,
                        "b":0
                    }
                ]
            },
            {
                "m":44,
                "items":[
                    {
                        "a":0,
                        "b":0
                    },
                    {
                        "a":0,
                        "b":0,
                        "d":"world"
                    }
                ]
            }
        ]
    };
    var b = {
        "a":33,
        "b":44,
        "c":[
            {
                "m":33,
                "items":[
                    {
                        "a":10,
                        "b":10
                    },
                    {
                        "a":10,
                        "b":10
                    }
                ]},
            {
                "m":44,
                 "items":[
                     {
                         "a":10,
                         "b":10
                     },
                     {
                         "a":10,
                          "b":10
                     }
                 ]
                }
        ]
    };
    extendDeep($scope.sample,b);
}