title: function called multiple times from template
body: <p>In my template I have something like this:</p>
  
  <pre><code>{{formatMyDate(date)}}
  </code></pre>
  
  <p>but <code>date</code> is a scope variable that is not immediately available so this expression will call the function <code>formatMyDate()</code> many times (returning <code>undefined</code>) before returning the correct value.</p>
  
  <p>I could check if the <code>date</code> is not null within the function but I guess it would be more clean NOT to call the function at all if the <code>date</code> is <code>null</code>.</p>
  
  <p>Any way to achieve this?
  Would a custom filter help me out here?</p>
  
  <p><strong>EDIT:</strong><br>
  It was suggested that this behaviour could be normal, depending on the $digest cycle.<br>
  I've then put a <code>scope.$watch</code> to verify how many times the value of <code>date</code> is changing.<br>
  Note that I'm defining these in a directive. </p>
  
  <pre><code>scope.$watch('date', function(value){
    console.log('watched_date: ' + value)
  })
  </code></pre>
  
  <p>and I've introduced a console.log() on my <code>formatMyDate</code> function as well</p>
  
  <pre><code>scope.formatMyDate = function(date){
    console.log("called_date: " + date)
    return dateService.format(date, 'YYYY-MM-DD')
  }
  </code></pre>
  
  <p>Inspecting the console I get (pseudo code)</p>
  
  <pre><code>called_date: undefined
  watched_date: undefined
  called_date: undefined // many many times (around 20/30)
  called_date: correctValue //2 or 3 times 
  watched_date: correctValue 
  called_date: correctValue //other 3/4 times
  </code></pre>
  
  <p>I'm wondering if this is still due to the <code>$digest</code> cycle or it is a bug in my code</p>