Accessing a parent scope from a child directive
Posted
by
zok
on Stack Overflow
See other posts from Stack Overflow
or by zok
Published on 2014-06-10T21:21:17Z
Indexed on
2014/06/10
21:24 UTC
Read the original article
Hit count: 249
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');
}
}
© Stack Overflow or respective owner