angular-tree-view
angular-tree-view copied to clipboard
Help to newbie in angular
Hi, I am trying to add your tree-view into angular tabs I've created inside ng-template but nothing happens. any suggestions ?
mycontroller:
(function() { 'use strict'; var tableCam;
angular.module('app').controller('TabsController', TabsController);
TabsController.$inject = [ 'UserService', '$rootScope' ];
function TabsController(UserService, $rootScope) {
var vm = this;
//skipped many more functions and other stuff....
vm.structure = { folders : [ { name : 'Folder 1', files : [ { name : 'File 1.jpg' }, { name : 'File 2.png' } ], folders : [ { name : 'Subfolder 1', files : [ { name : 'Subfile 1' } ] }, { name : 'Subfolder 2' }, { name : 'Subfolder 3' } ] }, { name : 'Folder 2' } ] };
vm.options = {
onNodeSelect : function(node, breadcrums) {
vm.breadcrums = breadcrums;
}
};
}
})();
Hello, The first thing I see is that you're adding the properties to the controller itself, not the scope. In fact, you're not even injecting the scope into the controller. You would need to change a few things:
TabsController.$inject = [ 'UserService', '$rootScope', '$scope' ];
function TabsController(UserService, $rootScope, $scope) {
$scope.structure = {
// All your files and folders
};
$scope.options = {
onNodeSelect : function(node, breadcrums) {
$scope.breadcrums = breadcrums;
}
};
// The rest of your code
}
I ignore if you're using that $rootScope in the omitted code or if you mistook it for $scope.
I've injected the scope and still no luck :
the functions are there.
its like it doens't work inside text/ng-temlpate

I wouldn't know where the error is. Can you create a JS fiddle and share the link?
Hi, thanks for your help. I've solved it forgot to add the module:
but my issue now is that I also use Angular Tabs that also use ul/li. see image.
