So, I have noticed a pattern that has appeared in how I develop directives, and I'm wondering if there isn't a better way to accomplish the same thing. Specifically, I find that in a directive with its own scope (either isolated or inherited), it is sometimes useful to add utility methods to the parent scope. For example:
directive('hello', function() {
return {
restrict: 'A',
scope: {},
link: function(scope, elem, attrs) {
scope.$parent.alert = function() {
var who = attrs.hello || 'World'