title: how to redirect using ng-click
body: <p>Super-simple AngularJS app I'm trying to build, to accept credentials into two text boxes, then use two-way binding to redirect on a button click to a url which includes the two variables in it.</p>
  
  <p>My problem is, I can get it working for a simple</p>
  
  <pre><code>&lt;a href=...&gt;
  </code></pre>
  
  <p>(or maybe ng-href=...) but for some reason, no matter what I do, I can't get a redirect using a</p>
  
  <pre><code>&lt;button&gt;
  </code></pre>
  
  <p>I've tried a lot of variations, but here's what I'm trying to do</p>
  
  <pre><code>&lt;button ng-click="$location.path('http://example.com/login.jsp?un={{username}}&amp;pw={{password}}')" class="btn btn-lg btn-warning"&gt;Log In!&lt;/button&gt;
  </code></pre>
  
  <p>I CAN get it working if I call a function in a controller, but this is such a simple thing, I'd like to get it done on the page if possible.</p>
  
  <p>Also, as a side-question, what are the security concerns of logging into a site like this?</p>
  
  <p>**
  Edit:  The part that confuses me is, this works (just without two-way binding working):</p>
  
  <pre><code>&lt;button onClick="window.open('http://www.example.com/{{username}}');"&gt;
  </code></pre>
  
  <p>I'd expect that changing onClick to ng-click would give me the same behaviour, but with two-way binding.</p>
  
  <p>**Re-Edit / Solution
  Alright, so I finally got a workable solution.</p>
  
  <p>I have NO idea why the Button tag won't work to give this behaviour, as stated above, but here's the working code.</p>
  
  <pre><code>&lt;a href="https://www.example.com/login.jsp?un={{username}}&amp;pw={{password}}" class="btn btn-lg btn-warning"&gt;Log In!&lt;/a&gt;
  </code></pre>
  
  <p>By giving it the same class as I intended to use for the button, the text shows up looking like a button, just the same.</p>