error和ng-if
error和ng-if的判断条件都没有起到作用,是怎么回事啊
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
<style>
.error{
border:1px solid #a10;
}
</style>
</head>
<body ng-app="myApp" ng-control="mainController">
<form name="register" ng-submit="submitForm()">
<div class="form-group">
<label>用户名:</label>
<input name="username"
ng-model="username"
ng-class="{'error':register.username.$invalid && register.username.$touched}"
ng-minlength="4"
required
class="form-control">
<div ng-if="register.username.$invalid && register.username.$touched">输入错误</div>
</div>
</form>
<script src="http://code.angularjs.org/angular-1.0.1.min.js"></script>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
</body>
</html>