Sistema de Comentarios multinivel

angular.module('name_module').directive('paintTree', function($compile) { return { scope: { idparent: '=', childrens: '=', userid: '=' }, restrict: 'E', templateUrl: 'ng/views/items_query.html', transclude: true, controller: function($scope, $element, $attrs, $transclude) { $scope.usr_logued = $scope.$parent.usrConectado; $scope.responder = function(comment, id_query) { $scope.$parent.responder(comment, id_query); } }, compile: function(tElement, tAttr) { var contents = tElement.contents().remove(); var compiledContents; return function(scope, iElement, iAttr) { if(!compiledContents) { compiledContents = $compile(contents); } compiledContents(scope, function(clone, scope) { iElement.append(clone); }); }; } }; }); El HTML <ul> <li class="media" ng-repeat="query in querys.parents"> <paint-tree idparent="query.id" childrens="querys.childrens" userid="usrConectado.id"></paint-tree> </li> publicationModule.controller("QuerysGetCtrl", [ '$scope', '$location', 'querysFactory', 'Modals', '$timeout', 'sessionesService', '$routeParams', function($scope, $location, querysFactory, Modals, $timeout, sessionesService, $routeParams) { var id_publication = $routeParams.id_publication; $scope.querys = []; var get_querys = function(id_publication) { querysFactory.get_querys(id_publication).success(function(data) { if(data.res === 'success') { console.log(data.data); $scope.querys = data.data; $scope.querys.childrens = data.data.childrens; $scope.querys.parents = data.data.parents; } }).error(function(xhrl, error) { console.log('error: '+ xhrl); }); } .....

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.