Accessing a parent scope from a child directive
- by zok
The following code does not work. Apparently I cannot access someFunction() from child-dir.
Is it a matter of accessing a parent scope from a child directive? How to do it, when the child directive comes from an external library?
Angular/HTML:
<parent-dir ng-controller="parentCtrl">
<child-dir ng-click="someFunction()">
</child-dir>
</parent-dir>
JS:
.controller('parentCtrl', function($scope) {
$scope.someFunction() {
console.log('hello');
}
}