title: angularjs checkbox and it aumatically checked when page load but can't be unchecked on a first try
body: <p>This is my uncheck box code:</p>
  
  <p></p>
  
  <p>I'm using JavaScript <code>onpageload</code> for getting my checkbox checked when the page loads.</p>
  
  <pre><code>function checkBox()
  {
      test = document.getElementsByTagName("md-checkbox");
  
      for (i=0;i&lt;test.length;i++)
      {
          if(test[i].getAttribute("aria-checked")=="false")
          {
              test[i].setAttribute("aria-checked","true");
              test[i].setAttribute("class","ng-valid md-default-theme md-checked ng-dirty ng-valid-parse ng-touched");
          }
      }
  }
  </code></pre>
  
  <p>But now when I try to uncheck it, it is only unchecked on the second click.
  So what can I do to fix that?</p>