title: Pass optional argument to angular directive
body: <p>I have the following directive:</p>
  
  <pre><code>angular.module("app").directive("validator", validator);
  
  function validator() {
  
    var validator = {
      link: link,
      replace: false,
      require: "^validation",
      restrict: "A"
    };
  
    return validator;
  
    function link(scope, element, attributes, controller) {
    }
  
  }
  </code></pre>
  
  <p>And I am applying it as follows:</p>
  
  <pre><code>&lt;span validator&gt;&lt;/span&gt;
  </code></pre>
  
  <p>How can I pass an optional argument to the directive? Something like:</p>
  
  <pre><code>&lt;span validator="arg value"&gt;&lt;/span&gt;
  </code></pre>
  
  <p>or is it better?</p>
  
  <pre><code>&lt;span validator validator-arg="arg value"&gt;&lt;/span&gt;
  </code></pre>
  
  <p>I then need, inside link function, to check if the argument is null or not.</p>