I created a function called reset(username) to log whatever is entered into the input field with ng-model="username"
. However, I am not seeing anything in the console. Why is that happening?
Here is my function:
$scope.reset = function (username) {
console.log(username);
};
And here is how I submit the form:
<form name="Form" ng-controller="ResetController" ng-submit="reset(username)">
<div>
<div class="row top5">
<label for="username">Username</label>
<div class="col-xs-4">
<input type="text" id="username" placeholder="" maxlength="255"
ng-model="username" required autofocus>
</div>
<div>
<div class="col-xs-5">
<button translate class="btn btn-secondary" type="submit">Reset</button>
</div>
</div>
</div>
</form>
As requested, here is the controller:
app.controller("ResetController", function ($scope) {
$scope.username='';
$scope.reset = function (username) {
console.log('username = ', username);
};
});