title: Setting $scope variables from a directive
body: <p>The directive in question is this guy here:
  <a href="https://stackoverflow.com/questions/17287176/dynamic-template-in-directive-based-on-attributes">Dynamic template in directive based on attributes?</a></p>
  
  <p>Anyway, here's what I'm trying to accomplish.</p>
  
  <p>This <code>&lt;titlebar&gt;</code> directive can take an attribute called <code>edit-button</code>. If this exists, and when the button is clicked, I'd like to set a $scope variable in my controllers that will toggle the visibility of buttons to delete/edit an item. </p>
  
  <p>For example, if I set <code>$scope.currentlyEditting = true;</code> in my directive, I'd tie this to the controller, and then use <code>ng-show</code> to show/hide the controls. I'm just not sure how to get that data into my controller. </p>
  
  <p><strong>titleBar directive</strong>:</p>
  
  <pre><code>robus.directive("titlebar", function() {
    return {
      restrict: "E",
      template: "&lt;header class='bar-title' ng-class='{\"sub-view\": view}'&gt;"+
                "&lt;a class='button' ng-click='goBack()' ng-show='back'&gt;&lt;i class='icon-arrow-left'&gt;&lt;/i&gt; Back&lt;/a&gt;" +
                "&lt;h1 class='title' ng-transclude&gt;" +
                "&lt;span class='sub-title' ng-show='view'&gt;{{view}}&lt;/span&gt;&lt;/h1&gt;" +
                "&lt;a class='button' ng-click='showEdit()' ng-show='edit'&gt;Edit&lt;/a&gt;" +
                "&lt;/header&gt;",
      scope: {
        view: '@view',
        edit: '@editButton',
        back: '@backButton'
      },
      transclude: true,
      replace: true,
      link: function ($scope, $element, attrs, ctrl) {
        // $scope.$apply();
      },
      controller: function($scope, $element, $attrs, $location, $routeParams) {
        /* simple back button implementation */
        $scope.goBack = function() {
          history.back(-1)
        }
  
        // $scope.showEdit = function() {
        //   $scope.currentlyEditting = true;
        // }
      }
    }
  });
  </code></pre>