AngularJS – append row after element in directive -


my question similar this one, instead of prepending row, want append.

this doesn’t work:

app.directive('createtable', function ($compile) {   return {     link: function (scope, element, attrs) {       var contenttr = angular.element('<tr><td>test</td></tr>');       contenttr.parentnode.insertbefore(element, contenttr.nextsibling);       $compile(contenttr)(scope);     }   } }); 

this job:

app.directive('createtable', function ($compile) {     return {         link: function(scope, element, attrs) {             if (element.next().length) {                 element.next().insertbefore(element);             }              var contenttr = angular.element('<tr><td>test</td></tr>');             contenttr.insertafter(element);             $compile(contenttr)(scope);         }     } }); 

http://jsfiddle.net/3gt9j/3/


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -