How to implement diff-match-patch or jsdiff in Angular 4?
I've tried
import DiffMatchPatch from 'diff-match-patch'
const dmp = new DiffMatchPatch()
const diff = dmp.diff_main('dogs bark', 'cats bark', null, null)
this.foo = diff
and binding it by
<div [innerHtml]="foo"></div>
but still don't really know how to bind result to my.component.html. Example above doesn't work as well
You can use jsDiff like so:
import * as jsdiff from 'diff'
...
const diff = jsdiff.diffLines(str1, str2)