title: Converting from JavaScript to Angular JS
body: <p>I have a written a pretty sturdy script in JavaScript for password validation but want to move from regular JS to angular. is this easily done?
  will my code need much modifying in terms of all the if statements and so on?</p>
  
  <p>here is a snippet: </p>
  
  <pre><code>function passwordValidation(){
      var uname = document.getElementById("pword1").value;
      var pword = document.getElementById("cPassword").value;
      var matchCol = "#009900";
      var noMatchCol = "#CC0000";
      var noBg = "#FFFFFF";
      var re = /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[\\\+\=\.,\[\]_£|\`¬':\;\~{}&lt;&gt;()#?!\@$\%^&amp;*-]).{8,20}$/;
  
      if (uname.length &lt; 1){
          cPassword.style.backgroundColor = noBg;
          match = "";
      }else{
  
      if (uname == pword){
          match = "Match!";
          cPassword.style.backgroundColor = matchCol;
          cPassword.style.borderColor = matchCol;
      }else if(pword.length &lt; 1){
          cPassword.style.backgroundColor = noBg;
          match = "";
      }
      else {
      match = "No Match!";
          cPassword.style.backgroundColor = noMatchCol;
          cPassword.style.borderColor = noMatchCol;
      }
      document.getElementById("combination").innerHTML = match;
  
  }
  }
  </code></pre>
  
  <p>i've tried simply converting but obviously I need to bind everything.</p>