title: AngularJs directive: call method from parent scope within template
body: <p>I'm pretty new to Angular directives, and I'm having a lot of trouble getting this to do what I want. Here's the basics of what I have:</p>
  
  <p>Controller:</p>
  
  <pre><code>controller('profileCtrl', function($scope) {
    $scope.editing = {
      'section1': false,
      'section2': false
    }
    $scope.updateProfile = function() {};
    $scope.cancelProfile = function() {};
  });
  </code></pre>
  
  <p>Directive:</p>
  
  <pre><code>directive('editButton', function() {
    return {
      restrict: 'E',
      templateUrl: 'editbutton.tpl.html',
      scope: {
        editModel: '=ngEdit'
      }
    };
  });
  </code></pre>
  
  <p>Template (editbutton.tpl.html):</p>
  
  <pre><code>&lt;button
    ng-show="!editModel"
    ng-click="editModel=true"&gt;&lt;/button&gt;
  &lt;button
    ng-show="editModel"
    ng-click="updateProfile(); editModel=false"&gt;&lt;/button&gt;
  &lt;button
    ng-show="editModel"
    ng-click="cancelProfile(); editModel=false"&gt;&lt;/button&gt;
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;edit-button ng-edit="editing.section1"&gt;&lt;/edit-button&gt;
  </code></pre>
  
  <p>If it's not clear, I want the <code>&lt;edit-button&gt;</code> tag to contain with three different buttons, each interacting with whatever scope property is passed into <code>ng-edit</code>. When clicked, they should change that property then call the appropriate scope method.</p>
  
  <p>The way it is now, clicking the buttons correctly changes the values of <code>$scope.editing</code>, but the <code>updateProfile</code> and <code>cancelProfile</code> methods don't work. I may be way off base on how to use directives properly, but I'm having trouble finding an example online to help me accomplish what I'm trying to do. Any help would be appreciated.</p>