ngx-simple-text-diff
v0.0.7
Published
Angular 2+ implementation of the diff library for displaying diffs of text. [https://www.npmjs.com/package/diff](https://www.npmjs.com/package/diff)
Downloads
176
Readme
NgxSimpleTextDiff
Angular 2+ implementation of the diff library for displaying diffs of text. https://www.npmjs.com/package/diff
Quickstart
- Install
ngx-simple-text-diff
from npm
npm i ngx-simple-text-diff
- Include the diff.js script
in angular.json:
...
"scripts": ["./node_modules/diff/dist/diff.min.js"]
...
- Import
NgxDiffModule
to your app:import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { NgxSimpleTextDiffModule } from 'ngx-simple-text-diff'; import { AppComponent } from './app.component'; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, NgxSimpleTextDiffModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }
- Use the
lib-ngx-simple-text-diff
component by setting theoldText
andnewText
attributes:<lib-ngx-simple-text-diff [oldText]="oldDocumentContents" [newText]="newDocumentContents"></lib-ngx-simple-text-diff>