I'm trying to create a mat-spinner next to a custom button of a datatable with jquery with no luck so far:
The button is configured as below:
{
text: '<i class="fa fa-file-excel-o"></i> Export',
className: 'btn btn-success btn-sm',
init: function(api, node) {
//...
},
action: function() {/*...*/}
}
After configuring the table I create an ng-container in the following way:
this.table
.buttons()
.container()
.append($('<ng-container #export/>'));
I can see the tag is added to the DOM but it's like it doesn't exist for angular 'cause adding @ViewChild('export', {read: ViewContainerRef}) export to my compononent's class always results in undefined. This way I would be able to create dynamically the MatSpinner and add it to the export container.
I also tried to create the spinner the same way as the ng-container but the same result. Do you have any idea how I would get this done?
Thank you in advance!
ViewContainerRefsome how and always give meundefined, so I'm not able to insert theMatSpinnerthe way you pointed me out.