Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kubohiroya committed Feb 1, 2018
1 parent b5248d3 commit c0d5df7
Show file tree
Hide file tree
Showing 7 changed files with 8,175 additions and 19 deletions.
21 changes: 5 additions & 16 deletions dist/angular-ui-tree.js
Expand Up @@ -198,8 +198,8 @@

angular.module('ui.tree')

.controller('TreeNodesController', ['$scope', '$element',
function ($scope, $element) {
.controller('TreeNodesController', ['$scope', '$element', '$timeout',
function ($scope, $element, $timeout) {
this.scope = $scope;

$scope.$element = $element;
Expand Down Expand Up @@ -243,22 +243,11 @@
return $scope.$modelValue.length > 0;
};

$scope.safeApply = function (fn) {
var phase = this.$root.$$phase;
if (phase == '$apply' || phase == '$digest') {
if (fn && (typeof (fn) === 'function')) {
fn();
}
} else {
this.$apply(fn);
}
};

//Called in apply method of UiTreeHelper.dragInfo.
$scope.removeNode = function (node) {
var index = $scope.$modelValue.indexOf(node.$modelValue);
if (index > -1) {
$scope.safeApply(function () {
$timeout(function () {
$scope.$modelValue.splice(index, 1)[0];
});
return $scope.$treeScope.$callbacks.removed(node);
Expand All @@ -268,7 +257,7 @@

//Called in apply method of UiTreeHelper.dragInfo.
$scope.insertNode = function (index, nodeData) {
$scope.safeApply(function () {
$timeout(function () {
$scope.$modelValue.splice(index, 0, nodeData);
});
};
Expand Down Expand Up @@ -409,8 +398,8 @@
scope.$emptyElm.append(tdElm);
} else {
scope.$emptyElm = angular.element($window.document.createElement('div'));
scope.$dropzoneElm = angular.element($window.document.createElement('div'));
}
scope.$dropzoneElm = angular.element($window.document.createElement('div'));

if (config.emptyTreeClass) {
scope.$emptyElm.addClass(config.emptyTreeClass);
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-ui-tree.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/angular-ui-tree.min.js

Large diffs are not rendered by default.

0 comments on commit c0d5df7

Please sign in to comment.