效果基本show的消息後嘗試這樣
<div class="col-sm-6 form-group">
<label for="text">Text</label>
<input class="form-control input-lg" type="text" id="text" required name="text" ng-model="user.text" **ng-change="OnChange()"** placeholder="Enter your text">
</select>
</div>
<div class="col-sm-6 form-group">
<label for="email">Email Address</label>
<input class="form-control input-lg" type="email" id="email" required name="email" ng-model="user.email" **ng-change="OnChange()"** placeholder="Enter your email">
</div>
的js側
$Scope.OnChange=function(){
$scope.updateStatus=false;
$scope.$apply();
}
調用此ng-change="OnChange()"
到所有領域
或嘗試此警告標籤。您可以刪除警報不需要的時間。
<div ng-controller="AlertDemoCtrl">
<alert ng-repeat="alert in alerts" type="alert.type" close="closeAlert($index)">{{alert.msg}}</alert>
<button class='btn btn-default' ng-click="addAlert()">Add Alert</button>
</div>
js代碼
function AlertDemoCtrl($scope) {
$scope.alerts = [
{ type: 'danger', msg: 'Oh snap! Change a few things up and try submitting again.' },
{ type: 'success', msg: 'Well done! You successfully read this important alert message.' }
];
$scope.addAlert = function() {
$scope.alerts.push({msg: "Another alert!"});
};
$scope.closeAlert = function(index) {
$scope.alerts.splice(index, 1);
};
}
演示:http://plnkr.co/edit/?p=preview
只是分配falsy價值,你的updateStatus範圍變量。 –
在哪裏分配這個值? – Anup
你想在超時後(setTimeout())隱藏消息還是用戶編輯了一些東西? –