You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| diffChange | string | Optional | Event fired when diff changes. The returned value is the diff in [unified format](http://fileformats.archiveteam.org/wiki/Unified_diff)
35
+
| diffChange | string | Optional | Event fired when diff changes. The returned value is the text diff in [unified format](http://fileformats.archiveteam.org/wiki/Unified_diff)
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.2.14.
3
+
A simple text diff component for Angular, based on [diff-match-patch](https://github.com/google/diff-match-patch) & [diff2html](https://github.com/rtfpessoa/diff2html).
4
4
5
-
## Code scaffolding
5
+
## Demo
6
6
7
-
Run `ng generate component component-name --project ngx-diff2html` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-diff2html`.
8
-
> Note: Don't forget to add `--project ngx-diff2html` or else it will be added to the default project in your `angular.json` file.
| diffChange | string | Optional | Event fired when diff changes. The returned value is the text diff in [unified format](http://fileformats.archiveteam.org/wiki/Unified_diff)
36
+
37
+
## Usage
38
+
39
+
1) Register the `NgxDiff2htmlModule` in a module, for example app module:
40
+
41
+
```diff
42
+
import { BrowserModule } from '@angular/platform-browser';
43
+
import { NgModule } from '@angular/core';
44
+
45
+
import { AppComponent } from './app.component';
46
+
+ import { NgxDiff2htmlModule } from 'ngx-diff2html';
47
+
48
+
@NgModule({
49
+
declarations: [AppComponent],
50
+
imports: [
51
+
BrowserModule,
52
+
+ NgxDiff2htmlModule
53
+
],
54
+
providers: [],
55
+
bootstrap: [AppComponent]
56
+
})
57
+
export class AppModule {}
58
+
```
59
+
60
+
2) Add the following line to `polyfills.ts`:
61
+
62
+
```diff
63
+
// Add global to window, assigning the value of window itself.
64
+
+ (window as any).global = window;
65
+
```
66
+
67
+
3) Start using the component:
68
+
69
+
```
70
+
<ngx-diff2html
71
+
left="some text"
72
+
right="some other text"
73
+
/>
74
+
```
9
75
10
76
## Build
11
77
@@ -15,10 +81,6 @@ Run `ng build ngx-diff2html` to build the project. The build artifacts will be s
15
81
16
82
After building your library with `ng build ngx-diff2html`, go to the dist folder `cd dist/ngx-diff2html` and run `npm publish`.
17
83
18
-
## Running unit tests
19
-
20
-
Run `ng test ngx-diff2html` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
-
22
-
## Further help
84
+
## License
23
85
24
-
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
86
+
This project is licensed under the [MIT](LICENSE) license.
0 commit comments