I'm trying to derive jquery datatable to create my custom datatable and make the columns dynamic. I can't pass the colums as an object. I'm getting a string in the directive controller.
var columns =
{
cols: [
{
"mDataProp": "Name",
"render": function (data, type, full, meta) {
return '<a href="#/u/d/' + full.Id + '">' + full.Name + '</a>';
}
},
{ "mDataProp": "prop2" }
};
function getColumns() {
return columns;
}
<my-table
columns='columns'
message="my message"></my-table>
app.directive('myTable', function () {
return {
restrict: 'E',
templateUrl: '/TableView.html',
replace: false,
controller: function ($scope) {
// $scope.urun =
// $scope.arg1 = attrs.headerText;
//
},
scope: {
columns: '=columns'
},
link: function (scope, element, attrs) {
var columns = attrs.columns;
console.log(columns);
}
}