A few things to consider:

If checkboxHandler is meant to be a generic directive where what is done 
when something is changed can vary, then you would pass in the method to 
call in your HTML and wire it up through the isolate scope of your 
directive.

If checkboxHandler is always meant to use the vote service (probably should 
be called checkboxVoteHandler in that case), then there is nothing wrong 
with injecting the vote service into your directive and calling it directly.

In most cases directives do not need controllers. The link function serves 
effectively the same function as a controller (setting up data and methods 
on the scope). In that sense, controllers in directives are different than 
regular controllers. They are strictly necessary only if you want to 
provide an API to other directives (via require: mechanism). Other than 
that, controller and link function overlap quite a bit, and you should just 
use the link function unless your directive has an API it needs to expose 
to other directives.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to