I am trying to dynamically create an element in angular that has a directive. the directive in question is nbButton and applies certain classes to the element. the button is rendered at runtime by dataTable, but unfortunately the classes are not applied and I am not finding a way to force the element to be updated.
datatable configurations are as follows:
const conf: any = {
paging: true,
...
buttons: [
{
text: 'filter',
action:() => {
sidebarService.toggle();
},
attr: {
nbButton: '',
}
},
...
]
}
this.categoryTable.DataTable(conf);
the attribute is inserted correctly into the element, but the directive is not executed not even by running change ChangeDetectorRef.detectChanges() or similar.
in the example above, "foo" is a button built outside of dataTable with directive, "Filtra e cerca" is a datatable's button to which I manually added the first classes, "Aggiungi nuovo" and "Azioni" are elements with the directive applied but without classes
some idea?