<input id= "username" type= "text" placeholder="username">;
<inpur id= "password" type= "password" placeholder= "password">
var usernameLength = angular.element('#username').val().length;
var passwordLength = angular.element('#password').val().length;
console.log(usernameLength);
console.log(passwordLength); 即可得到要的字符串长度。