Ivh-treeview
//html
//<div class="col-md-9 col-xs-12" ivh-treeview="parentSelectorTv" ivh-treeview-option="parentTvOpts" ivh-treeview-on-cb-change="tvCbChange(ivhNode, ivhIsSelected, ivhTree)"></div>
$scope.parentSelectorTv = [
{
value: null,
label: 'Trang gốc',
selected: true,
children: []
}];
ivhTreeviewMgr.deselect($scope.parentSelectorTv, $scope.parentSelectorTv[0].children[0]);
$scope.resursiveMenu = function (parent) {
//anchor
if (!$scope.allMenu.existBy('parentId', parent ? parent.value : 0)) { //
return;
}
$scope.allMenu.forEach(function (elm) {
if (elm.parentId === (parent ? parent.value : 0)) {
if (parent) {
parent.children = parent.children || [];
parent.children.push(elm);
} else {
$scope.listParentSelector.push(elm);
}
$scope.formatTreeData(elm);
}
});
}
//get selected node
ivhTreeviewBfs($scope.parentSelectorTv, function (node) {
if (node.selected) {
model.push(node);
}
});