0

I have checkbox on child app controller, so when user click on it, I need to call some method from parent controller: Parent app controller:

<div ng-controller="ParentCntr as parentCntr">
    <child-app></child-app>
</div>

Child app:

   <div class="child-app" ng-controller="ChildCntr as childCntr">
       <div class="checkbox no-indent">
          <input type="checkbox"
                 name="test"
                 id="test"
                 ng-change="childCntr.DisableText()"
                 ng-model="childCntr.testVar"/>
         <label for="test">Some Text</label>
       </div>
   </div>

So, how to do this in easiest way?

Ted
  • 1,682
  • 3
  • 25
  • 52

1 Answers1

0

So to access to the parent scope you can use $parent like this :

<div ng-controller='SecondCtrl' ng-click='$parent.testFunction()'>{{$parent.name}}</div>

Here is a working example.

JeanJacques
  • 1,754
  • 1
  • 12
  • 25