【发布时间】:2016-04-27 09:17:12
【问题描述】:
我想在 angularjs 控制器中隐藏节点及其所有相关边。我正在使用 angular-vis.js。我的代码只能隐藏节点,但不能隐藏边。
$scope.hideSelection = function()
{
$scope.data.nodes.update([{id: $scope.selectedNode.toString(), hidden: true}]); // this part is working fine
$scope.hiddenNodes.push($scope.selectedNode);
if ($scope.selectedEdges.length > 0){
$scope.selectedEdges.forEach(function(edgeId){
$scope.data.edges.update([{id: edgeId.toString(), hidden: true}]); // When it comes here it not doing the update as it did on nodes
$scope.hiddenEdges.push(edgeId);
});
}
}
这是我的plunker 的链接以查看完整示例
【问题讨论】: