javascript - Angular Datatable ng-click not working -
got problem ng-click on angular datatables. i'm using https://l-lin.github.io/angular-datatables
here code
$scope.dtoptions = dtoptionsbuilder.fromfnpromise(function(){ return $resource(apiroot + 'categories').query().$promise; }) .withoption('order', [0, "asc"]); $scope.dtcolumns = [ dtcolumnbuilder.newcolumn('id', 'id').withoption('searchable', false), dtcolumnbuilder.newcolumn('name', 'name'), dtcolumnbuilder.newcolumn('', 'actions').renderwith(function (data, type, full, meta) { return '<a class="btn btn-default btn-xs" href="#/edit/' + full.id + '"><i class="fa fa-pencil"></i></a> ' + '<button class="btn btn-danger btn-xs" ng-click="deleteitem(' + full.id + ')"><i class="fa fa-trash"></i></button>'; }) ]; $scope.deleteitem = function (id) { alert('delete') }
delete button not working.
is there wrong code?
$scope.dtoptions = dtoptionsbuilder.fromfnpromise(function(){ return $resource(apiroot + 'categories').query().$promise; }) .withoption('createdrow', createdrow) .withoption('order', [0, "asc"]); function createdrow(row, data, dataindex) { // recompiling can bind angular directive dt $compile(angular.element(row).contents())($scope); console.log("test"); } //now ur deleteitem function complied , it'll work. $scope.deleteitem = function (id) { alert('delete') }
Comments
Post a Comment