html----------
<input type="text" ng-keyup="Message($event,20)" maxlength="100" placeholder="请输入1~100个字符">
<span class="hintMessage">最多输入100个字符</span>
js----------------
// 字符长度限制
$rootScope.Message = function($event,num){
$this = $($event.target);
$this.val($this.val().replace(/[\/:&*?"<>|\%\`s]/g,''));
if($this.val().length >= num){
$this.siblings(".hintMessage").show();//显示或隐藏提示
}else{
$this.siblings(".hintMessage").hide();
}
};