To create HTML element (button): The below div should be defined before diagram div.
|
<div id='button_div' style="height:100%;width:100%;border:none; background-color:white;"><img src="./app/diagram/diagram/Nodes_1.png" width="100%;height:50px"/></div> |
Angular : To get the button and show as content of the Node |
ngAfterViewInit(): void {
let node: NodeModel = this.diagram.nodes[6];
// ‘button_div’ id of div which want to show as content of node.
node.shape = { type: 'HTML', content: document.getElementById('button_div') };
this.diagram.dataBind();
}
|
// A connector is created and stored in connectors array.
let connector: ConnectorModel = {
id: 'connector1',
sourcePoint: {
x: 300,
y: 100
},
targetPoint: {
x: 400,
y: 300
},
type: 'Orthogonal',
//Sets the annotation for the node
annotations: [{
// Sets the template for a node
template: '<div><input type="button" value="Submit"></div>'
}]
};
|