angular5-htmldiff-js
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Angular5HtmldiffJs

This project is a Wrapper Angular5 plugin for htmldiff-js (https://www.npmjs.com/package/htmldiff-js)

Usage

Install

npm install angular5-htmldiff-js --save

Html

<html>
<body>
    <div id="oldHtml">
        <p>Some <em>old</em> html here</p>
    </div>
 
    <div id="newHtml">
        <p>Some <b>new</b> html goes here</p>
    </div>
 
    <div class="highlight-diff">
        <app-htmldiff [html1]="oldHtml.innerHTML" [html2]="newHtml.innerHTML"></app-htmldiff>
    </div>
</body>
</html>

Import

 
import { HtmldiffModule } from './modules/htmldiff/htmldiff.module';
 
@NgModule({
  ...,
  imports: [
    ...,
    HtmldiffModule
  ],
  providers: [],
  bootstrap: [...]
})

Typescript

 
ngOnInit(): void {
    this.oldHtml = document.getElementById('oldHtml');
    this.newHtml = document.getElementById('newHtml');
  }

CSS

.highlight-diff ins {
    background-color: #ffff00;
}
 
.highlight-diff del {
    background-color: #edb3b3;
}

Package Sidebar

Install

npm i angular5-htmldiff-js

Weekly Downloads

3

Version

1.0.2

License

MIT

Unpacked Size

46.6 kB

Total Files

24

Last publish

Collaborators

  • swapnilkumbhare