Sergii Sergii - 9 months ago 87
AngularJS Question

Angular directive. NgTable data loading

In my AngularJS application I use directive to have flexible ability of template using. One of templates contains ngTable. Data for ngTable was loaded correctly from server till it was not wrapped with directive. To fix this issue I tried using onload event for including template to call method of parent controller. Seems i did not fix scope issue for ngTable, because as I can see getData: function(params) was not called. I think it was not called because of new NgTableParams was called\created in controller scope, not in directive.

Is any ideas how it can be fixed?


Great thanks to Mark Rajcok. In directive I changed scope in next way:

scope: true

All explanations and details here. So problems of injecting ng-table using directive is solved (possible it is not best way, but it is completely useful for me).