How to pass custom functions to AngularJS directives
2015, Jun 24
In case you need to pass a callback to your AngularJS directives, looks like one way is to create an isolated scope and create a member with the ‘&’ attr. Here’s a quick&dirty example:
In case you have to pass some arguments to the callback, here’s how:
Notice that the argument is transformed in a javascript object and passed to the callback. This one is actually a wrapped function around the one you passed.
In case you need it, the Toptal team has put together a nice Q/A list with several worth reading best-practices.