And I referenced the onReorder function like this:
`
`
Without .bind($ctrl) the context is obviously undefined. But passing .bind($ctrl) I receive the error:
**vendor.js:56763 Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!**
How can I properly pass the context of my controller to the onReorder function?
The answer from @daniel-nagy in [changed how the onPaginate callback fn is bound](https://github.com/daniel-nagy/md-data-table/pull/400) seems kinda bad practice to me.
I have the the following reorder function in my controller class (ES2015):
And I referenced the onReorder function like this:
`
Don't use
bind
in your template, use it in your constructor.I think using
bind
is forbidden in angular expressions becuase it creates a new function,Also binding the method in the constructor will be more efficient.
This approach looks a bit better to me.
I did not know that .bind() returns a new function. Using thing technic on filters like
| filter: $ctrl.filterFunc.bind($ctrl)
works.