title: ng-init assign values conditionally
body: <p>I found an unexpected behavior of <code>ng-init</code>. According to the doc <code>The ngInit directive allows you to evaluate an expression in the current scope.</code> So I'm trying to assign a value in a variable conditionally. Here is my code</p>
  
  <pre><code>&lt;a ng-href="#" ng-click="flag = !flag;" ng-init="data = (flag == true) ? 'Value For Success' : 'Value for false'; "&gt; {{data}}&lt;/a&gt;
  </code></pre>
  
  <p>If in expression I pass <code>false</code> then false value will be assigned to variable and if I pass <code>true</code>, then true value will be assigned. I can achieve it by calling a function but I thought if I could assign value in a single line then why I need to write a function for that. Please suggest what I'm missing ?</p>
  
  <p>Check my <a href="https://jsfiddle.net/eqbjuwzc/" rel="nofollow">fiddle</a></p>