5 angular.module('demoApp', ['ds.objectDiff'])
7 '$interpolateProvider',
8 function ($interpolateProvider) {
9 return $interpolateProvider.startSymbol('{(').endSymbol(')}');
12 .controller('DemoController', DemoController);
14 DemoController.$inject = ['$scope', 'ObjectDiff'];
16 function DemoController($scope, ObjectDiff) {
17 $scope.objectOne = "{\n" +
26 $scope.objectTwo = "{\n" +
36 var objectOne, objectTwo, diff;
38 $scope.errorA = false;
39 objectOne = eval('(' + $scope.objectOne + ')'); //JSON.parse($scope.objectOne);
44 $scope.errorB = false;
45 objectTwo = eval('(' + $scope.objectTwo + ')'); //JSON.parse($scope.objectTwo);
50 // you can directly diff your objects if they are not string
51 diff = ObjectDiff.diffOwnProperties(objectOne, objectTwo);
53 $scope.diffValue = ObjectDiff.toJsonView(diff);
54 $scope.diffValueChanges = ObjectDiff.toJsonDiffView(diff);
56 $scope.yourObjectOne = objectOne;
57 $scope.yourObjectTwo = objectTwo;
60 $scope.$watch('objectOne', function (newValue, oldValue) {
63 $scope.$watch('objectTwo', function (newValue, oldValue) {