Skip to content

Instantly share code, notes, and snippets.

@agustinhaller
Last active August 29, 2015 14:03
Show Gist options
  • Select an option

  • Save agustinhaller/4aeb59473cb7c1eff984 to your computer and use it in GitHub Desktop.

Select an option

Save agustinhaller/4aeb59473cb7c1eff984 to your computer and use it in GitHub Desktop.
.controller('TreeDemoCtrl', function($scope, $http, $log) {
$scope.list = [];
$http.get('tx_1.json')
// $http.get('taxonomy.json')
.then(function(res){
$scope.list = res.data;
});
$scope.selectedItem = {};
$scope.options = {};
$scope.remove = function(scope) {
scope.remove();
};
$scope.editItem = function(item) {
item.editing = true;
};
// $scope.cancelEditingItem = function(item) {
// item.editing = false;
// };
$scope.saveItem = function(item) {
// group.save();
item.editing = false;
};
$scope.toggle = function(scope) {
scope.toggle();
};
$scope.lazyLoad = function(item) {
debugger;
if(_.isUndefined(item.items))
{
$http.get('tx_1.json')
.then(function(res){
item.items = res.data;
});
}
$log(item.id);
// $scope.toggle();
};
return $scope.newSubItem = function(scope) {
var nodeData;
nodeData = scope.$modelValue;
nodeData.items.push({
id: nodeData.id * 10 + nodeData.items.length,
title: nodeData.title + "." + (nodeData.items.length + 1),
items: []
});
};
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment