Articles in this section
Category / Section

How to Set a Read-Only Mode in Angular Diagram?

2 mins read

In this article, you can learn about how to set a Read-Only mode in Angular Diagram. Setting a diagram to read-only mode in Syncfusion® Angular Diagram is useful in scenarios where you need to display information without allowing users to modify its contents.

For example, this could be useful for presenting static data or in cases where the diagram serves a reference or visualization purpose but should not be altered by the user.

To make a diagram read-only, you need to set the constraints property to DiagramConstraints.None. This disables all user interactions such as dragging, resizing, or modifying nodes and connectors in the diagram.

export class AppComponent {

 @ViewChild('diagram') public diagram: DiagramComponent;
 public constraints: DiagramConstraints;

 public nodes: NodeModel[] = [
   {
     id: 'node1',
     offsetX: 250, offsetY: 250,
     height: 100, width: 100,
     annotations: [{ content: 'node1' }],
     style: { fill: '#64CAA8' },
   }
 ];
 ngOnInit(): void {
   // Constraints to enable read-only diagram
   this.constraints = DiagramConstraints.None;
 }

} 

You can find a working example of this implementation on StackBlitz in the provided link: Click here for sample

Conclusion

I hope you enjoyed learning how to set read-only mode in Angular Diagram.

You can refer to our Angular Diagram feature tour page to learn about its other groundbreaking feature representations and documentation to quickly get started with configuration specifications. You can also explore our Angular Diagram example to understand how to create and manipulate data.

For current customers, you can check out our components on the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to explore our other controls. If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, BoldDesk Support, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied