Make sure to include ng-sanitize in your app and utilize the ng-bind-html directive in your HTML for dynamically generated content from your controller.
When creating your app module, remember to add ngSanitize like this:
angular.module('myApp',[ngSanitize])
However, it seems like there might be a better approach to what you're trying to achieve.
Consider defining the table structure in your HTML and using ng-repeat to populate the rows. Hide the table with ng-if until the necessary event occurs.
You could also implement this using a component.
In your component's HTML file, simply lay out your table as shown in the factory code stored in tableauComponent.html.
<table>
<tr>
<th>Matricule</th>
<th>Sexe</th>
<th>Direction</th>
<th>Type_contrat</th>
</tr>
<tr ng-repeat="x in tableau.data">
<td>{{ x.MATRICULE }}</td>
<td>{{ x.SEXE }}</td>
<td>{{ x.DIRECTION }}</td>
<td>{{ x.TYPE_CONTRAT }}</td>
</tr>
</table>
To register the component in your app, use the following code:
angular.module("myApp").component("tableauComponent", {
templateUrl: 'tableauComponent.html',
controller: tableauController,
controllerAs: 'tableau'
})
function tableauController() {
var ctrl = this;
this.data = service call to get your data here.
}
Then, wherever you want to display the component in your HTML, insert this tag:
<tableau-component></tableau-component>