AngularJS - Access a parent controller from child -> child directive with the controllerAs notation -
i'd access function parent => parent controller inside directive (with controlleras notation). i'm using angular 1.3.14 have following structure:
- controller (with save function)
- (child) controller
- directive template (and isolated scope). inside template have button should call save function parent (parent) controller.
- (child) controller
i don't want call $scope.$parent.$parent.save(...) has idea?
thanks in advance.
use $scope.save().
in angular there scope hierarchy , calling $scope.save() directive in directive's scope, if there no save() method, in parent's scope , on. 1 condition don't have isolated scope directive.
Comments
Post a Comment