. node node. . Coffeescript, JS:
angular.module("myApp.directives").directive("visGraph", function($timeout, $window) {
return {
restrict: "AE",
link: function(scope, element, attrs) {
var buildGraph;
buildGraph = function(scope, element) {
var container, graph;
container = element[0];
graph = null;
graph = new vis.Graph(container, scope.data, scope.options);
return graph.on('doubleClick', function(properties) {
if (properties.nodes.length !== 0) {
return $window.location = FRONTEND_URL + properties.nodes;
}
});
};
scope.$watch('data', function(newval, oldval) {
buildGraph(scope, element);
}, true);
}
};
});
$scope.data $scope.options.
vis-graph.
, !