updates when the tree does it's initialization , fixes migration

This commit is contained in:
Shannon
2018-04-19 21:58:59 +10:00
parent db5ffd6b29
commit 642ce36f59
2 changed files with 12 additions and 5 deletions

View File

@@ -53,7 +53,9 @@ function umbTreeDirective($compile, $log, $q, $rootScope, treeService, notificat
controller: function ($scope, $element) {
var vm = this;
var vm = this;
var isInitialized = false;
var registeredCallbacks = {
treeNodeExpanded: [],
@@ -269,9 +271,17 @@ function umbTreeDirective($compile, $log, $q, $rootScope, treeService, notificat
return treeService.getTree(args)
.then(function (data) {
//set the data once we have it
$scope.tree = data;
//call the callback, this allows for hosting controllers to bind to events and use the exposed API
if (!isInitialized) {
isInitialized = true;
$scope.onInit();
}
enableDeleteAnimations();
$scope.loading = false;
@@ -421,9 +431,6 @@ function umbTreeDirective($compile, $log, $q, $rootScope, treeService, notificat
lastSection = newVal;
}
});
//call the callback, this allows for hosting controllers to bind to events and use the exposed API
$scope.onInit();
loadTree();
}