GoJS editor is get refreshed

I have an GoJS(1.7.1) memo editor.Using this editor I can create memo which contains text, image and freehand drawing.
When clicked save button, I want to save memo and clear editor.

I am using following code to clear diagram.model

	$scope.model.nodeDataArray = [];		

But the content of the editor is not cleared.It will clear only when I click on the editor.

I am also tried

Still it is not cleared on save button click.

Could you please suggest any idea/trick to clear my editor?

If you are using GraphLinksModel your code won’t remove any links.

The easiest way to clear a diagram is to replace the Diagram.model with an empty one. No transaction is needed or permitted.

Or call Diagram.clear.

Diagram.clear() is working fine.Thanks

One more issue related to nodeDataArray update

$scope.model.nodeDataArray = nodeArray;

diagram is refreshed only when click on diagram.

I just tried executing:

    myDiagram.model.nodeDataArray = [];
    myDiagram.model.linkDataArray = [];

as well as:

    myDiagram.model.nodeDataArray = [{ key: 1, text: "Start" }, { key: 2, text: "End" }];
    myDiagram.model.linkDataArray = [{ from: 1, to: 2 }];

from an HTML button (i.e. not while doing something in the diagram), and it updated correctly, immediately, without any interaction on my part as a user.