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. Image for the cookie policy date
close icon

Diagram saving method (saveDiagram ) not working when i'm adding second layer


I'm using Angular diagram and when I'm adding second layer on run time ( exactly like example on documentation) and then I'm trying to save with saveDiagram method but there is errorerror on saving.PNG

there is no problem when diagram have only one layer

this first layer

  public layers: LayerModel[] = [
      id: 'customLayer1',
      visible: true,
      lock: false,
      addInfo: {
        describtion: 'default layer',

and this is how im adding layer

  addLayer() {
    let newLayer: LayerModel = {
      id: `customLayer${(this.diagram?.layers.length || 0) + 1}`,
      visible: true,
      lock: false,
      addInfo: {
        describtion: '',
        order : '-1'        
    this.diagram?.addLayer(newLayer, []);
    this.diagram?.setActiveLayer(newLayer.id || '');

and then im adding node from the pallet , all my nodes are native

if i add node to diagram.layers[0] there is no problem

but when im using this code 


then draging node from pallet , and now  saveDiagram  is not working any more.

Note: ​version of diagram "@syncfusion/ej2-angular-diagrams": "^20.4.42",

Note : ​in both layeres i have only Native nodes.

2 Replies

LM Liam Mir January 22, 2023 10:06 AM UTC


I have solved problem


problem was above line

I delete this and problem solved

here is stackblitz sample


BM Balasubramanian Manikandan Syncfusion Team January 23, 2023 03:02 PM UTC

Please contact us if you need further assistance.

Live Chat Icon For mobile
Up arrow icon