- A simple text diff
component
to be used with Angular 6 and based ongoogle diff match patch
library.
- diff-match-patch : ^1.0.4
- angular-core >= 6.0.0
npm i ngx-text-diff
module: NgxTextDiffModule
component: NgxTextDiffComponent
selector: td-ngx-text-diff
Input | Type | Required | Description |
---|---|---|---|
left | string | Yes | First text to be compared |
right | string | Yes | Second text to be compared |
format | type | Optional, default: 'SideBySide' | Possible values: -'SideBySide' -'LineByLine' |
- Register the
NgxTextDiffModule
in a module, for example app module.
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { NgxTextDiffModule } from 'ngx-text-diff';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, NgxTextDiffModule],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}
Run ng build ngx-text-diff
to build the library. The build artifacts will be stored in the dist/ngx-text-diff
directory. Use the --prod
flag for a production build.
This project is based on google diff match patch.