Commit 0a1199f8 by lepdou

bugfix: diff directive undifined exception

parent 5b36cc6e
...@@ -29,7 +29,10 @@ directive_module.directive('apollodiff', ...@@ -29,7 +29,10 @@ directive_module.directive('apollodiff',
span = null, span = null,
pre = ''; pre = '';
var diff = JsDiff.diffLines(scope.oldStr, scope.newStr), var oldStr = scope.oldStr == undefined ? '' : scope.oldStr;
var newStr = scope.newStr == undefined ? '' : scope.newStr;
var diff = JsDiff.diffLines(oldStr, newStr),
fragment = document.createDocumentFragment(); fragment = document.createDocumentFragment();
diff.forEach(function (part) { diff.forEach(function (part) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment