AngularJS – append row after element in directive
问题 My question is similar as this one, but instead of prepending row, I want it to 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); } } }); 回答1: This does the job: app.directive('createTable', function ($compile) { return { link: function(scope, element, attrs) { if