angularjs - What is the best practice to pass parameters from Controller to a directive? -
i'm new in angularjs
in angular app, have directive , controller. need controller send options of kinds of configurations, including callback methods.
my directive element implements 1 button post data webservice. desire controller send url "post" method , send callback method, have called after "post" in directive.
how best way this? practice send callback methods this?
i specify parameters in tags of element. instance:
<my-directive my-service="someservice" my-callback="somecallback" />
inside directive use $parse function read/set these values:
var getservice = $parse(attrs.myservice), setservice = getservice.assign, service = getservice(scope);