title: Where to put a helper function in angular's directive?
body: <p>I created a simple directive:</p>
  
  <pre><code>angular.module("foo").directive('bar',function(){
      return {
          ...
          template:
              '&lt;div&gt; \
                  &lt;div ng-hide="param1.length == 0 &amp;&amp; param2..."&gt;...&lt;/div&gt; \
                  &lt;input ng-show="param1.length == 0 &amp;&amp; param2..." .../&gt; \
               &lt;/div&gt;',
          scope: {
              param1: '=',
              param2: '='
          }
      };
  });
  </code></pre>
  
  <p>but there is a duplicated complex logic inside the template so i would like to extract it to a function and just call that function from a template. Where can I put such function and how can I invoke it? Do I have to create a dedicated controller?</p>