Skip to content

Commit 3a91da1

Browse files
committed
update modelChangedListener in ngDiagramHelper
1 parent 2b1d280 commit 3a91da1

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# dependencies
1111
/node_modules
1212
/src/app
13+
/src
1314

1415
# profiling files
1516
chrome-profiler-events.json

projects/gojs-angular/src/lib/ng-diagram-helper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ export class NgDiagramHelper{
7676
if (component.hasOwnProperty("diagram")) diagram = component["diagram"];
7777
if (component.hasOwnProperty("palette")) diagram = component["palette"];
7878
component.modelChangedListener = (e: go.ChangedEvent) => {
79-
if (e.isTransactionFinished && diagram && diagram.model && !diagram.model.isReadOnly) {
79+
if (e.isTransactionFinished && e.model && !e.model.isReadOnly && component.modelChange) {
8080
// this must be done within a NgZone.run block, so changes are detected in the parent component
8181
component.zone.run(() => {
8282
const dataChanges = e.model!.toIncrementalData(e);
83-
component.modelChange.emit(dataChanges);
83+
if (dataChanges !== null) component.modelChange.emit(dataChanges);
8484
});
8585
}
8686
};

0 commit comments

Comments
 (0)