hello,
i want to disable my input submit for the first it works nice, i want to disable my input after adding same one this is my code it works fine
Html :
<form class="form-horizontal col-md-6" role="form" name="frm">
<button type="submit" class="btn btn-success" ng-click="Add(false)" ng-disabled="frm.$invalid">Ajouter</button>
</form>
AngularJS:
app.controller('UserAdminAddController', function ($scope, httpService) {
$scope.Add = function () {
var data = {
firstname: $scope.firstname,
lastname: $scope.lastname
};
var log = httpService.request('api/User/AddUserByForm/', 'put', data);
log.then(function (result) {
if (result.data.Status == 'Succeed') {
$("input[name='Firstname']").val(null);
$("input[name='Lastname']").val(null);
$('#Succeed').fadeIn();
$('#Succeed').delay(3000).fadeOut(); }
else {
}
});
}
};
});
css:
input.ng-invalid.ng-dirty{border:1px solid red;}
What I have tried:
For the first time i have user ng-disabled="frm.$invalid" for my submit buton