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.

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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -