Jointjs和angular:ng click不起作用

时间:2015-12-24 07:17:58

标签: angularjs jointjs

我正在创建一个带有关节js的元素并将其放入纸张中。该元素在铅笔中有一个ng-click指令。但是当我点击元素时

元素

joint.shapes.flowie.Rect  = joint.shapes.basic.Generic.extend(_.extend({}, joint.shapes.basic.PortsModelInterface, {

        markup: '<g class="rotatable"  ><g class="scalable"><rect class="body"/></g><text class="label"/><text region="" transform="translate(40,10)" ng-init="alert()" ng-click="loadStep(workflow.steps[this.stepName])" class="fa edit fa-pencil">&#xf040;</text><g class="inPorts"/><g class="outPorts"/></g>',
        portMarkup: '<g class="port port<%= id %>"><circle class="port-body"/><text class="port-label"/></g>',

        defaults: joint.util.deepSupplement({

            type: 'devs.Model',
            size: { width: 1, height: 1 },

            inPorts: [],
            outPorts: [],

            attrs: {
                '.': { magnet: false },
                '.body': {
                    width: 150, height: 350,
                    stroke: '#000000'
                },
                '.port-body': {
                    r: 8,
                    magnet: true,
                    stroke: '#000000'
                },
                text: {
                   // 'pointer-events': 'none'
                },
                '.label': { text: 'Model', 'ref-x': .5, 'ref-y': 10, ref: '.body', 'text-anchor': 'middle', fill: '#000000' },
                '.inPorts .port-label': { x:-15, dy: 4, 'text-anchor': 'end', fill: '#000000'},
                ".inPorts circle": {type:"input", magnet:"passive" },
                '.outPorts .port-label':{ x: 15, dy: 4, fill: '#000000',type:"output" }
            }

        }, joint.shapes.basic.Generic.prototype.defaults),

        getPortAttrs: function(portName, index, total, selector, type) {

            var attrs = {};

            var portClass = 'port' + index;
            var portSelector = selector + '>.' + portClass;
            var portLabelSelector = portSelector + '>.port-label';
            var portBodySelector = portSelector + '>.port-body';

            attrs[portLabelSelector] = { text: portName };
            attrs[portBodySelector] = { port: { id: portName || _.uniqueId(type) , type: type } };
            attrs[portSelector] = { ref: '.body', 'ref-y': (index + 0.5) * (1 / total) };

            if (selector === '.outPorts') { attrs[portSelector]['ref-dx'] = 0; }

            return attrs;
        }
    }));

通过保存表单触发了saveStep功能。表单包含每个元素的一些元数据 然后,我执行以下操作将步骤添加到图表中                     shape = new joint.shapes.flowie.Start({                         位置:{x:10,y:10},                         尺寸:{宽度:100,高度:30},                         attrs:{rect:{fill:&#39; blue&#39; },&#39; .label&#39;:{text:step.stepName,fill:&#39; white&#39; },                         stepName:名称                     });                 shape.set(&#39; inPorts&#39;,[]);                 shape.set(&#39; outPorts&#39;,[&#39; OUT&#39;]);             graph.addCells([形状])

我听说过编译指令,但无法找到使用它的方法。

0 个答案:

没有答案