I am using angularjs and datatable to build a grid. I have a following javascript code,
DEMO: http://plnkr.co/edit/qJ7vr1Bec5OdRrxpHw2Q?p=preview
datatable_config = {
"bJQueryUI": true,
"bProcessing": true,
"bDeferRender": true,
"sDom": "Rlfrtip",
"aaData": [null]
};
angular.forEach(columns, function(column, key){
datatable_config.aoColumns.push({
"sTitle": column.displayName,
"mData": function(source, type, value){
var cell_value = (source[column.field]) ? source[column.field] : '', rendered_cell;
if(column.field == 'something'){
rendered_cell = $compile('<span>{{$root.value}}</span>')($scope);
/* For this column, I am not getting the span element with the evaluated rootscope instead, it says [object object] */
} else {
rendered_cell = cell_value;
}
return rendered_cell;
}
});
});
When I compile the HTML, it displays [object object]. I am getting the problem, we need to compile it after the bind, like this element.html(value); $compile(element.contents())(scope);. But it is not possible in the above code. Any solution or idea?
Thanks in advace.