title: angularjs unsafe ng-href using javascript: void(0);
body: <p>I have a similar question to <a href="https://stackoverflow.com/questions/15637133/unsafe-link-in-angular">this post</a>.</p>
  
  <p>But adding "javascript" what was proposed in the answer didn't resolve my problem:</p>
  
  <pre><code>$compileProvider.urlSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|javascript):/);
  </code></pre>
  
  <p>My code looks something like:</p>
  
  <pre><code>&lt;a ng-href="{{var1 ? '/home' : 'javascript: void(0);'}}" ng-bind="var2"&gt;&lt;/a&gt;
  </code></pre>
  
  <p>But in the url, it produces an <code>unsafe:javascript: void(0);</code></p>