Is it possible to restrict the input in my text field username without using regex? I want users to only enter numbers and letters, with no white spaces or special characters.
<div class="form-group has-feedback" ng-class="addUser.username.$valid ? 'has-success' : 'has-error';">
<label class="control-label" for="username">Username</label>
<input class="form-control" name="username" ng-model="user.username" required>
<span class="glyphicon form-control-feedback" ng-class="addUser.username.$valid ? 'glyphicon-ok' : 'glyphicon-remove';"></span>
</div>
This section is from the controller.
$scope.users = [{
username: "a"
}];
$scope.addUser = function(user) {
$dialog.open({
showClose: false,
closeByEscape: true,
template: 'views/user/user-user-add.html',
controller: ['$scope', function($dialogScope) {
$dialogScope.isLoading = false;
$dialogScope.errorMessage = "";
$dialogScope.title = "New User";
$dialogScope.user = {
username: ""
};
I would appreciate any assistance on this matter. Thank you.