View source

jsplumbEndpoint
directive in module ovh-angular-jsplumb

Description

Create a graph endpoint

Example

    // script.js
    angular.module("myApp", ["ovh-angular-jsplumb"]);
    angular.module("myApp").controller("foo", function() {
         var self = this;

         this.instanceOptions = {
              PaintStyle : {
                  lineWidth : 2,
                  strokeStyle : "#354291"
              },
              HoverPaintStyle : {
                  lineWidth : 4,
                  strokeStyle : "#354291"
              },
              MaxConnections : -1
         };

         this.anchors = {
              bottom : {
                 source : {
                     anchor : [0.5, 0.5, 0, 1],
                     connector: connector
                 },
                 target : {
                     anchor : [0.5, 0.5, 0, 1],
                     connector: connector
                 }
             },
             top : {
                 source : {
                     anchor : [0.5, 0.5, 0, -1],
                     connector: connector
                 },
                 target : {
                     anchor : [0.5, 0.5, 0, -1],
                     connector: connector
                 }
             }
         };

         $scope.$on("jsplumb.instance.created", function (evt, instance) {
             self.jsPlumb = instance;
             instance.Defaults.Container=$("body");
         });

        function init() {
           self.jsplumbReady = false;
           jsPlumbService.jsplumbInit().finally(function () {
               self.jsplumbReady = true;
           });

        }

        init();
    });
    <div data-ng-if="Foo.jsplumbReady" data-jsplumb-instance="Foo.instanceOptions">
        <div id="one"
              data-jsplumb-endpoint-source-options="Foo.endpointOptions.top.source"
                 data-jsplumb-endpoint-target-options="Foo.endpointOptions.bottom.target"
                 data-jsplumb-endpoint-connection-ids="[]">hello world</div>

        <div id="two"
              data-jsplumb-endpoint-source-options="Foo.endpointOptions.top.source"
              data-jsplumb-endpoint-target-options="Foo.endpointOptions.bottom.target"
              data-jsplumb-endpoint-connection-ids="['one']">hello world</div>
    </div>

Usage

as attribute
<ANY jsplumb-endpoint
     id="{String}"
     jsplumb-endpoint-connection-ids="{Array@}"
     jsplumb-endpoint-source-options="{Object}"
     jsplumb-endpoint-target-options="{Object}">
   ...
</ANY>

Directive info

  • This directive creates new scope.

Parameters

ParamTypeDetails
idString

Identifier of the endpoint

jsplumbEndpointConnectionIdsArray@

Identifiers to link to

jsplumbEndpointSourceOptionsObject

Options of the endpoint as source

jsplumbEndpointTargetOptionsObject

Options of the endpoint as target