Skip to content

Commit

Permalink
- Fix/workaround to digest recursion exception for larger (deeper) ob…
Browse files Browse the repository at this point in the history
…jects
  • Loading branch information
Tysen Moore committed Jan 9, 2017
1 parent d9a87cc commit f4c4927
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions dist/json-formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ angular.module('jsonFormatter', ['RecursionHelper'])
};
})

.directive('jsonFormatter', ['RecursionHelper', 'JSONFormatterConfig', function jsonFormatterDirective(RecursionHelper, JSONFormatterConfig) {
.directive('jsonFormatter', ['RecursionHelper', 'JSONFormatterConfig', '$timeout', function jsonFormatterDirective(RecursionHelper, JSONFormatterConfig, $timeout) {
function escapeString(str) {
return str.replace('"', '\"');
}
Expand Down Expand Up @@ -238,7 +238,10 @@ angular.module('jsonFormatter', ['RecursionHelper'])
};

scope.$watch('open', function(value) {
scope.isOpen = !!scope.open;
// Without the timeout we get digest recursion
$timeout(function() {
scope.isOpen = !!scope.open;
},10);
}, false);
}

Expand Down

0 comments on commit f4c4927

Please sign in to comment.