Get auto deleted links in SelectionDeleted?

If you selected a node it also deletes its links which I want. Is there a way to also get the links that were auto deleted? I could get the links collection but some of those links might be selected (and part of diagram.selection) and others not. My code handles everything in diagram.selection but I need to also get the auto-deleted links.

A Model Changed listener would be notified about all removals from the model.

Hi Walter,
I am not getting auto deleted links in ModelChanged event. Can you please elaborate in which array I will get auto deleted links?

New in version 2.0 is that the GoJS Events -- Northwoods Software DiagramEvent now provides a Set of all of the deleted Parts as the value of DiagramEvent.subject.

Hi Walter,
We are using gojs ~1.8.34 version with Angular 6. Is there another way to achieve auto deleted links?

You should be able to use a change listener.

myDiagram.addModelChangedListener(function(e) {
  if (e.isTransactionFinished) {
    var tx = e.object;
    if (tx instanceof go.Transaction) {
      const undo = e.propertyName === "FinishedUndo";
      tx.changes.each(function(e) {
        if ((e.change === go.ChangedEvent.Remove || undo && e.change === go.ChangedEvent.Insert) && e.propertyName === "linkDataArray") {
          var linkdata = undo ? e.newValue : e.oldValue;
          console.log("removed link { from: " + linkdata.from + ", to: " + linkdata.to + "}");
        }
      });
    }
  }
});