In JointJS, how an element accesses position, inPorts, outPorts?
javascript, jointjs, position
Solution
You can use `m1.get('position')` and `m1.get('inPorts')`. You could also use `m1.prop('position')` and `m1.prop('inPorts')`. The difference is that `get(property)` is only for accessing flat properties while `prop(path)` is able to get nested properties as well (e.g. `m1.prop('attrs/rect/fill')`.
Problem
I am using jointJS for my academic project, I have such a question, How an element accesses position, inPorts, outPorts? For example, we create an element like this, ``` var m1 = new joint.shapes.devs.Model({ position: { x: 50, y: 50 }, size: { width: 90, height: 90 }, inPorts: ['in1','in2'], outPorts: ['out'], attrs: { '.label': { text: 'Model', 'ref-x': .4, 'ref-y': .2 }, rect: { fill: '#2ECC71' }, '.inPorts circle': { fill: '#16A085' }, '.outPorts circle': { fill: '#E74C3C' } } }); graph.addCell(m1); ``` I want to get `position` and `inPorts` from `m1`, I have tried `m1( 'position' )` and `m1.position()` , but it didn't work. Can someone solve this problem? Thank you in advance.