Skip to content

Commit f08b0eb

Browse files
committed
Add diffChange event to library component
1 parent 52939ff commit f08b0eb

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

projects/ngx-diff2html/src/lib/ngx-diff2html.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnInit, Input, OnChanges, SimpleChanges, SimpleChange, ViewEncapsulation } from '@angular/core';
1+
import { Component, OnInit, Input, OnChanges, SimpleChanges, SimpleChange, ViewEncapsulation, Output, EventEmitter } from '@angular/core';
22
import { NgxDiff2htmlService } from './ngx-diff2html.service';
33
import { DiffFormat, DiffStyle } from './ngx-diff2html.model';
44

@@ -17,6 +17,7 @@ export class NgxDiff2htmlComponent implements OnInit, OnChanges {
1717
@Input() private filename: string = ' '; // cannot be null or empty
1818
@Input() private format: DiffFormat = 'line-by-line';
1919
@Input() private style: DiffStyle = 'word';
20+
@Output() diffChange: EventEmitter<string> = new EventEmitter();
2021
private diff: string = null;
2122
diffHTML: string = null;
2223

@@ -30,6 +31,7 @@ export class NgxDiff2htmlComponent implements OnInit, OnChanges {
3031
//console.log(changes);
3132
if (this.propHasChanged(changes.left) || this.propHasChanged(changes.right)) {
3233
this.getDiff();
34+
this.diffChange.emit(this.diff);
3335
} else if (this.propHasChanged(changes.style) || this.propHasChanged(changes.format)) {
3436
this.refreshDiffHTML();
3537
}

0 commit comments

Comments
 (0)