我需要清除一個文本框和選擇列表後,按鈕clicked.This是我試過,但它似乎並不工作:如何清除輸入字段Angularjs一個按鈕,點擊後
HTML:
<input type="text" ng-model="Model.CurrentDowntimeEvent.Comment" size="60" placeholder="ENTER IN ANY ADDITIONAL INFORMATION"/><br>
<select class="categories" ng-disabled="selectlistdisabled" ng-model="Model.CurrentDowntimeEvent.CategoryId" ng-options="downtimeCategory.CategoryId as downtimeCategory.CategoryName for downtimeCategory in Model.DowntimeCategories">
</select>
<button ng-click="StopCurrentDowntime()">Stop Downtime Event</button>
JS:
angular.module('myApp', [])
.controller('DowntimeController', function ($scope, $http) {
$scope.Model = new Model($http);
$scope.StopCurrentDowntime = function() {
$scope.CurrentDowntimeEvent.Comment = '';
$scope.CurrentDowntimeEvent.CategoryId = '';
}
});
http://stackoverflow.com/questions/15305764/angularjs-clear-input-text-with的-button –
@Can Sahin Bakir我看到了那個鏈接,但它對我不起作用 – user3811714