3

I'm using datatables along with angular and I have this piece of code:

   render: function (data, type, full, meta) {
         var buttonHtml = '<div style="text-align: center;">' +
                          '<button data-toggle="modal" data-target="#myModal" class="btn btn-primary btn-xs" data-ng-click="loadModal(' + meta.row + ')">' +
                          '<i class="fa fa-folder-open-o"></i>&nbsp;View' +
                          '</button>' +
                          '</div>';

         return buttonHtml;
    }

The above it's a handler from datatables to dynamically format a column based on data.

The problem is that the ng-click handler (loadModal) is never called and I guess because the html is never compiled. How could I solve this issue?

Dan
  • 1,555
  • 2
  • 14
  • 30

1 Answers1

0

Have a look at this answer: Angular: ng-bind-html filters out ng-click? it includes an example of a compile directive.

Community
  • 1
  • 1
Leo Farmer
  • 7,730
  • 5
  • 31
  • 47