title: jsDiff implementation in Angular 4
body: <p>How to implement <a href="https://www.npmjs.com/package/diff-match-patch" rel="nofollow noreferrer">diff-match-patch</a> or <a href="https://github.com/kpdecker/jsdiff" rel="nofollow noreferrer">jsDiff</a> in Angular 4?</p>
  
  <p>I've tried </p>
  
  <pre><code>import DiffMatchPatch from 'diff-match-patch'
  
  const dmp = new DiffMatchPatch()
  const diff = dmp.diff_main('dogs bark', 'cats bark', null, null)
  this.foo = diff
  </code></pre>
  
  <p>and binding it by </p>
  
  <pre><code>&lt;div [innerHtml]="foo"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>but still don't really know how to bind result to my.component.html. Example above doesn't work as well</p>