I have an angular directive with the following template code for a table placeholder:
<table class="table table-striped table-bordered table-hover" id="testTableId">
    <thead>
        <tr>
            <th ng-repeat="column in columns">{{columns}}</th>
        </tr>
    </thead>
</table>
I'm trying to load the table data from within a controller within the directive.
var table = $('#testTableId').DataTable({
                responsive: true,
                serverSide: true,
                ajax: {
                    url: myUrl,
                    dataSrc: ''
                },
                fnServerData: function (sSource, aoData, fnCallback, oSettings) 
                {
                    oSettings.jqXHR = $.ajax({
                        url: myUrl,
                        success: function (json, status, xhr) {
                            //Do stuff
                        }
                    });
                }    
            });
The data loads in the table but I have the following error in the console:
TypeError: Cannot read property 'childNodes' of undefined
My table headers are gone and if I inspect the HTML I can see my ng-repeat directive has been commented out.
Help please?
Added:
If I render the table beforehand outside the directive. Loading the data into the table works. Looks like it's some sort of timing issue.
 
    