I am new to ivh tree (https://github.com/iVantage/angular-ivh-treeview) and using this library. I want to disable to certain nodes for selection, based on user entitlement
for example i have tree like this
$scope.bag = [{
label: 'Glasses',
value: 'glasses',
entitled: false,
children: [{
label: 'Top Hat',
value: 'top_hat',
entitled: true
}, {
label: 'Curly Mustache',
value: 'mustachio',
entitled: false
}]
}];
};
So based on variable entitled: [boolean], it should let user select or unselect. how can this be done?
To accomplish this you'll need to put some logic into a custom node template. Here's a stripped down example where I've introduced a helper directive that just inspects the
node
scope value and disables its checkbox if needed.http://jsbin.com/buqaxu/2/edit?html,js,output
You'd could attach something like this to your the
ivh-treeview-checkbox
directive in your template. Note thatnode
is a supported scope variable within templates.