在单击“取消”时,我销毁了syncfusion treeview元素,在单击“添加”时,我想重新创建它。但是,当我重新创建树视图时,出现控制台错误TypeError: Cannot use 'in' operator to search for 'modelChange' in null
,我使用了use指令以树视图格式显示数据。
下面是用指令编写的代码
$scope.treeFunction = function() {
$("#treeView").ejTreeView({
allowDragAndDrop: true,
showCheckbox: $scope.allowCheckbox,
cssClass: 'mytree',
nodeCheck: function(args) {
$scope.checkedNode();
},
nodeUncheck: function() {
$scope.uncheckedNode();
}
});
$scope.changeState('expand');
}
permissionTreeDesignerController.$inject = ['$scope', '$rootScope']
return {
restrict: 'EA',
replace: 'false',
controller: permissionTreeDesignerController,
templateUrl: '../modules/directives/permissionTreeDesigner/permissionTreeDesigner.html',
scope: {
treeNodes: '=',
allowCheckbox: '=',
roles: '=roles',
selection: '=',
checkedNode: '&checkedNode',
uncheckedNode: '&uncheckedNode'
},
link: function(scope, element, attrs, ctrl) {}
}
下面是我的控制器html代码
<div class="modal-body bodySetting" ng-click="vm.openAddUserOrgModal()">
<permissiontreedesigner ng-if="vm.orgTreeReady==true" tree-Nodes="orgTreeFormatedData" checked-Node="vm.checkedNode()" unchecked-Node="vm.uncheckedNode()" roles="rolesForAssignRoles" selection="selectedroles" allow-Checkbox="isallowcheckbox"></permissiontreedesigner>
</div>
vm.openAddUserOrgModal = function () {
//code to set value to the directive function and variable
}