I have my model variables already bound to some hidden input fields in a form.
When the user hits the submit button, I try to update these fields by updating the corresponding bound model variables but they do not change (I noticed that when dumping the request on the server, I always receive the old data), also I noticed that every thing works O.K when I use normal text inputs rather than hidden inputs
Here is my code:
Form
<form name="bla bla" action="bla bla" method="post" ng-submit="updateForm()">
<input type="hidden" name="token" ng-model= "extra.token" />
<input type="hidden" name="filters" ng-model="extra.filters" />
<button type="submit">
submit form
</button>
</form>
Controller
var app = angular.module(... // bla bla
app.controller('MyController', ['$scope', ctrlDef]);
function ctrlDef($scope) {
$scope.extra = {};
$scope.extra.token = '';
$scope.extra.filters = '';
$scope.updateForm = function() {
$scope.extra.token = 'test1';
$scope.extra.filters = 'test2';
};
}