We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ejDiagram: methods/properties can be accessed only after plugin

Thread ID:

Created:

Updated:

Platform:

Replies:

133064 Oct 6,2017 06:38 PM UTC Oct 10,2017 03:55 AM UTC Angular 3
loading
Tags: ejDiagram
Julian Lyndon-Smith
Asked On October 6, 2017 06:38 PM UTC

I was trying to look at the json produced by the :save() method  in the `OnNgInit` method of my component, but get this error instead :

ejDiagram: methods/properties can be accessed only after plugin

How do I wait for the "after plugin" before attempting to access :save() ?


public ngOnInit() {
const diagram = $("#graph").ejDiagram("instance");

console.log(diagram.save())
}

<ej-diagram height="100%" id="graph">
<e-nodes>
<e-node name ="Start" type = "flow" shape="terminator" [width]="140" [height]="50" [offsetX]="300" [offsetY]="50">
<e-nodelabels>
<e-nodelabel text="Start"></e-nodelabel>
</e-nodelabels>
</e-node>
<e-node name ="Init" type = "flow" shape="process" [width]="140" [height]="50" [offsetX]="300" [offsetY]="140">
<e-nodelabels>
<e-nodelabel text="var i = 0;"></e-nodelabel>
</e-nodelabels>
</e-node>
</e-nodes>
<e-connectors>
<e-connector name="connector1" sourceNode="Start" targetNode="Init">
<e-segments>
<e-segment type="orthogonal"></e-segment>
</e-segments>
</e-connector>
</e-connectors>

</ej-diagram>

I tried to look at the events, but couldn't find any information



Shyam G [Syncfusion]
Replied On October 9, 2017 08:58 AM UTC

Hi Julian, 
 
Please use ngAfterViewInit method which triggers once the diagram is rendered. Please refer to the code example, sample and reference link to use that method. 
 
Code example: 
 
export class DiagramComponent implements AfterViewInit { 
      
            ngAfterViewInit() { 
                var diagram = $("#graph").ejDiagram("instance"); 
                var save=diagram.save(); 
                console.log(save); 
            } 
        } 
 
 
Regards, 
Shyam G 


Julian Lyndon-Smith
Replied On October 9, 2017 09:03 AM UTC

thanks - this worked


Shyam G [Syncfusion]
Replied On October 10, 2017 03:55 AM UTC

Hi Julian, 
Please let us know if you need further assistance on this. 
Regards, 
Shyam G 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;