title: Boolean Scope Value of a Directive
body: <p>Let's say I have a directive which looks like:</p>
  
  <pre><code>&lt;foo-bar bar-foo="booleanValue"&gt;&lt;/foo-bar&gt;
  </code></pre>
  
  <p><code>booleanValue</code> here belongs to the parent scope - the scope of the controller which is attached to the view in which the above directive element is located.</p>
  
  <p>Now, in my directive, I have defined the directive as follows:</p>
  
  <pre><code>app.directive('fooBar', function() {
      return {
          restrict: 'E',
          scope: {
              barFoo: '=barFoo'
          },
          link: function(scope, iElement, iAttrs) {
             scope.$watch('barFoo', function() {
                 if(scope.barFoo !== true) return;
             });
             //Code to execute when barFoo is true
          }
      };
  });
  </code></pre>
  
  <p>Problem here is that the value that is passed to <code>barFoo</code> is a boolean value, but it ends up being a string value. Thus `if (scope.barFoo !== true) will always be a success and the linker function never executes.  </p>
  
  <p>I do not want to change the code to <code>if (scope.barFoo === "true")</code>.  </p>
  
  <p>How do I pass a boolean value into the scope?</p>
  
  <p><strong>EDIT :</strong> I wish to add here that <code>booleanValue</code> is indeed a boolean value (passed as true usually) by the parent controller into the directive. Just that when the value is passed, it gets converted to string instead of remaining boolean.</p>