Here is the code snippet I am working with:
Controller:
vm.dtColumns = [
DTColumnBuilder.newColumn('product_code').withTitle('Code'),
DTColumnBuilder.newColumn('product_name').withTitle('Name'),
DTColumnBuilder.newColumn(null).withTitle('Actions').notSortable()
.renderWith(function(data, type, full, meta) {
return ` <button class="btn btn-info btn-raised" ng-click="openViewProductModal(${data.product_id})">View</button>`;
})
];
$scope.openViewProductModal = function(id) {
console.log(id)
}
HTML:
<div ng-controller="ProductCtrl as productControl" ng-init="loadProducts()">
<table datatable="" dt-options="productControl.dtOptions" dt-columns="productControl.dtColumns" dt-instance="productControl.dtInstance" class="row-border hover"></table>
</div>
Despite everything rendering perfectly, I am having trouble getting the console.log()
function to work. Is there something I am overlooking?