为什么 ngMessages 警报只出现一次?当我从引导选项中使用 (data-dismiss="alert" class="close") 时,警报被隐藏,但它再也不会出现。
<body ng-app="ngMessagesExample">
<form name="myForm">
<label>
Enter your name:
<input type="text" name="myName" ng-model="name" ng-minlength="5" ng-maxlength="20" required />
</label>
<pre>myForm.myName.$error = {{ myForm.myName.$error | json }}</pre>
<div ng-messages="myForm.myName.$error">
<div role="alert" class="alert alert-danger alert-dismissible fade in">
<button aria-label="Close" data-dismiss="alert" class="close" type="button">
<span aria-hidden="true">when close never display again -> ×</span>
</button>
<div ng-message="required">You did not enter a field</div>
<div ng-message="minlength">Your field is too short</div>
<div ng-message="maxlength">Your field is too long</div>
</div>
</div>
</form>
</body>
代码笔: http ://codepen.io/mescal/pen/PZpWjd?editors=101
谢谢!