I want to append <tr><button></button></tr> to the <thead>in the below html.
<table>
<thead>
<tr>
Header 1
</tr>
</thead>
</table>
Is it possible to achieve the idea above using angular directives?
in your linking function of your costum directive you can use
angular.element(document).find("thead").append("<tr><button></button></tr>")
your directive could look like this:
angular.module('app', [])
.directive('myDirective', ['$document', function($document) {
return {
link: function(scope, element, attr) {
angular.element(document).find("thead").append("<tr><button></button></tr>")
}
};
}]);
carefull i havent tested this code but this is the way to manipulate DOM in custom directives ,i will make a plunker when i can