I have several nested directives. I now need to invoke a function in deep child.
<parent-directive>
<child-directive>
<deep-child-directive></deep-child-directive>
</child-directive>
</parent-directive>
I want call method in deep-child-directive controller from parent-directive controller. Is there any way except $broadcast to do this?
my function:
$scope.refreshProductSearch = function() {
var isRefresh = true;
if( $rootScope.urlOption.query ) {
var selected = $rootScope.urlOption.query;
if( $rootScope.urlOption.query) {
var urlOption = util.jsonUrlParser(selected);
isRefresh = urlOption.query.searchs ? false : true;
}
}
if( isRefresh ) {
$scope.clearValues();
}
$scope.$emit("removeAdvanceSearch");
};