title: Angular directive binding
body: <p>I'm trying to have Two-Way binding on a directive.</p>
  
  <p>I can't use the <code>scope</code> on the directive (multiple directives on element), so I'll have to do it in the <code>compile(){...}</code> function</p>
  
  <p>This is a simplified version of the directive so far:</p>
  
  <pre><code>.directive('myDialog', function() {
        return {
          restrict: 'E',
          templateUrl: 'my-dialog.html',
          compile: function(tElement, tAttrs, transclude) {
            return function($scope, $element, $attributes) {
              $scope.label = $scope.$eval($attributes.label);
  
              // when I set the label on something this should update the parent
              $scope.label = "test";
            }
          }
        };
  </code></pre>
  
  <p>So how can I make it that when I change the lable in my directive it updates the value in the main application, and visa versa</p>
  
  <p>Plunker for testing:
  <a href="http://plnkr.co/edit/lARCrGD5FsnOWQZrahIl?p=preview" rel="nofollow">http://plnkr.co/edit/lARCrGD5FsnOWQZrahIl?p=preview</a></p>
  
  <p><strong>UPDATE</strong>:
  here is the actual setup with all the logic for what I'm trying to archieve: <a href="http://codepen.io/cskiwi/pen/eJryqK?editors=1010" rel="nofollow">http://codepen.io/cskiwi/pen/eJryqK?editors=1010</a></p>
  
  <p>On line 101 i want to set the testing var on true, later one I'm also going to set to testing var on false outside that directive</p>
  
  <p><strong>UPDATE2</strong>:
  Got something, that is maybe something to lookinto:</p>
  
  <pre><code>  return {
          restrict: "A",
          require: ["^mdChips", "^chipBar"],
          controller: "chipBarController",
          controllerAs: "chipBarController",
          bindToController: {
              activated: "="
          },
          // rest of the code
  </code></pre>
  
  <p>this is allowing to set the activated var to true from in the directive; but now I can't set the value from my appCtrl back to false</p>