title: How do I pass many values to an Angularjs directive?
body: <p>I'm creating a reusable bit of html via a directive.  The html would have a few variables that I want passed from the original scope.  This is done easily by declaring attributes on the directive, then creating an isolate scope and capturing them.  The question is, is there a better way to do this for a larger number of variables?  I had thought of passing in an object like <code>{firstAttr: $scope.one, secondAttr: $scope.two...}</code> and picking this object apart to get each piece. This works the first time, but the two-way databinding doesn't work (even using the '=').  </p>
  
  <p>The problem is the thing that is bound is the object, not each of the individual parts of the object.  Could I maybe use the compile function in the directive to add each of the attributes to the element or something? so:</p>
  
  <pre><code>&lt;mydirective databinding="{one:'first one', two:'second one'}"&gt;
  </code></pre>
  
  <p>would be translated into:</p>
  
  <pre><code>&lt;mydirective one="first one" two="second one"&gt;
  </code></pre>
  
  <p>That way my databinding would work as expected by capturing the attributes in the directive.  How would I go about accomplishing that design, or is there just another way completely to do this?</p>