I have a problem with the browsers credentials saving. The first time that I login with my app, the browser ask me to save the fields, I press ok, but when I login the second time and the browser fullfill the form fields with the saved credentials, I press login, and the browser send a request without parameters.
HTML
<div ng-controller="modalCtrl">
<script type="text/ng-template" id="login">
<form ng-submit="login()" class="login">
<input type="text" ng-model="data.username" placeholder="username" value="username" class="form-control" popover="inserisci qui il tuo username" popover-trigger="focus" popover-placement="right"/><br>
<input id="pwd" type="password" ng-model="data.password" placeholder="password" value="password" class="form-control" popover="inserisci qua la tua password" popover-trigger="focus" popover-placement="right"/><br>
<input class="btn-primary btn-lg" type="submit" value="Login">
</form>
</script>
</div>
JS
modalController.controller('modalCtrl',function ($scope, $modal) {
var open = function () {
var modalInstance = $modal.open({
templateUrl: 'login',
controller:this.loginCtrl,
backdrop:'static'
});
};
open();
});
var loginCtrl = function ($scope, $http, $modalInstance, $state) {
$scope.data = {username: this.username, password: this.password};
var data = $scope.data;
$scope.login = function () {
$http.post(server[0] + '/bbi-api/sauth/1', {name: data.username, password: data.password})
.then(function () {
$state.go('home');
$modalInstance.close();
},
function (response) {
alert(response.status);
});
};
};
The strange is that if I rewrite the credentials everything goes ok, but if I simply press the button with the credentials put by the browser, the app send a post with blank parameters.