Page 1 of 1

p-tree and canDeactivate

Posted: 26 Jun 2020, 23:20
by jmanko
Is there any way for a `p-tree` to hook into Angular's `canDeactivate`?

Code: Select all

<p-tree class="large" 
             [value]="treeNodes" 
             selectionMode="single" 
             [(selection)]="selectedNode"
             (onNodeSelect)="onNodeClick($event)">
    </p-tree>
(onNodeClick) grabs the node and navigates to it's view (that info is added to the node object). But if an existing component is marked with a canDeactivate, which triggers a dialog yes/no to the user, the tree still selects the clicked node.

The structure is of the components is something like:

Code: Select all

[component top]
   [component tree]
   <router-outlet></router-outlet>
[/component top]