In the \"Create Components\" section of AngularJS\'s homepage, there is this example:
controller: function($scope, $element) {
var panes = $scope.panes = [
The reason 'addPane' is assigned to this is because of the
directive.
The pane
directive does require: '^tabs'
, which puts the tabs controller object from a parent directive, into the link function.
addPane
is assigned to this
so that the pane
link function can see it. Then in the pane
link function, addPane
is just a property of the tabs
controller, and it's just tabsControllerObject.addPane. So the pane directive's linking function can access the tabs controller object and therefore access the addPane method.
I hope my explanation is clear enough.. it's kind of hard to explain.