Open werner opened 10 years ago
regarding your question, i have a tree with the "TREE ID" called tagtree, on click i load a LogicalTag.
works like that(in your controller)
$scope.$watch('tagtree.currentNode', function(newObj, oldObj) {
if ($scope.tagtree && angular.isObject($scope.tagtree.currentNode)) {
$scope.tag_selected = true;
$scope.tag_id = $scope.tagtree.currentNode.id;
// select current node for display
$scope.logicaltag = $scope.LogicalTag.get({
id: $scope.tagtree.currentNode.id
});
}
}, false);
still not working,treeview loaded from state view -> templateUrl
<div
data-angular-treeview="true"
data-tree-id="chapters"
data-tree-model="chapterdata"
data-node-id="id"
data-node-label="label"
data-node-children="children" >
</div>
$scope.$watch('chapters.currentNode', function( newObj, oldObj ) {
console.log('works')
if( $scope.chapters && angular.isObject($scope.chapters.currentNode) ) {
console.log( 'Node Selected!!' );
console.log( $scope.chapters.currentNode );
}
}, false);
I have codes showing above,and the dev console says 'works' when tree shows,but nothing happen after that,no matter which node I click on.
same issue here, some update about that?
Hi, I'm trying to use watch in controller to know what node is selected, but it is not working, is there any example?
Thanks