Friday, October 6, 2017

Using ng-click in a rendered column of Datatable

I’m using a plain Datatable in AngularJS (not using any Angular-Datatable libraries). Everything seems good so far, except for one thing.

I have this datatable:

$scope.siInfoTable = $('#siInfoTable').DataTable({
            'columns': [
                {
                    "render": function (data, type, row, meta) {
                        data =  '<button class="btn btn-primary btn-sm" ng-click="test()">TEST</button>';
                        return data;
                    }
                }]
        });

This is run inside a $scope.load method and is loaded before the page is rendered. When user clicks the rendered button in the datatable, it doesn’t seem to recognize the ng-click directive.

Is there a way around here?

Source: AngularJS



from Angular Questions https://angularquestions.com/2017/10/06/using-ng-click-in-a-rendered-column-of-datatable/
via @lzomedia #developer #freelance #web #lzomedia.com

No comments:

Post a Comment