How to access parent scope from within a custom directive *with own scope* in AngularJS?

后端 未结 6 609
终归单人心
终归单人心 2020-11-22 13:50

I\'m looking for any manner of accessing the \"parent\" scope within a directive. Any combination of scope, transclude, require, passing in variables (or the scope itself)

6条回答
  •  悲哀的现实
    2020-11-22 14:09

     scope: false
     transclude: false
    

    and you will have the same scope(with parent element)

    $scope.$watch(...
    

    There are a lot of ways how to access parent scope depending on this two options scope& transclude.

提交回复
热议问题