https://github.com/jjtortosa/ngx-simple-text-diff
Angular 2+ implementation of the diff library
https://github.com/jjtortosa/ngx-simple-text-diff
Last synced: about 1 month ago
JSON representation
Angular 2+ implementation of the diff library
- Host: GitHub
- URL: https://github.com/jjtortosa/ngx-simple-text-diff
- Owner: jjtortosa
- Created: 2020-03-07T17:40:49.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-04T13:20:32.000Z (about 3 years ago)
- Last Synced: 2025-11-04T09:08:09.828Z (4 months ago)
- Language: TypeScript
- Size: 5.83 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-angular - ngx-simple-text-diff - Angular library for displaying text differences using the [diff](https://www.npmjs.com/package/diff) library. (Framework Interoperability / Wrappers)
- fucking-awesome-angular - ngx-simple-text-diff - Angular library for displaying text differences using the 🌎 [diff](www.npmjs.com/package/diff) library. (Framework Interoperability / Wrappers)
README
# NgxSimpleTextDiff
Angular library for displaying text differences using the [diff](https://www.npmjs.com/package/diff) library.
## Installation
```bash
npm i ngx-simple-text-diff diff
```
Add the diff.js script to your `angular.json`:
```json
"scripts": ["./node_modules/diff/dist/diff.min.js"]
```
## Usage
### Standalone (recommended)
```typescript
import { Component } from '@angular/core';
import { NgxSimpleTextDiffComponent } from 'ngx-simple-text-diff';
@Component({
selector: 'app-example',
imports: [NgxSimpleTextDiffComponent],
template: `
`
})
export class ExampleComponent {
oldText = 'Hello world';
newText = 'Hello Angular';
}
```
### NgModule (legacy)
```typescript
import { NgModule } from '@angular/core';
import { NgxSimpleTextDiffModule } from 'ngx-simple-text-diff';
@NgModule({
imports: [NgxSimpleTextDiffModule]
})
export class AppModule { }
```
## Demo
[https://jjtortosa.github.io/ngx-simple-text-diff/](https://jjtortosa.github.io/ngx-simple-text-diff/)