angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

NgModel problem with browser auto fill.

Open marvinferreira opened this issue 12 years ago • 0 comments

Hi!

I am having problem with auto filled data from browser eg. username and password inputs in a login form.

When my loginController starts it assigns:
$scope.username = ""; $scope.password = ""; and also a submit function like this WebService.Auth.login($scope.username, $scope.password).then(function (user)....

My inputs looks like

It all works when users type their name and password, but if they have any auto filled login that they have saved in browser and try to use it both variables will be "" (as initialized by controller).

Note: I can solve my problem removing ng-model and both variables and changing my submit method to WebService.Auth.login($("#user").val(), $("#password").val()).then(function (user).... using jQuery to direct take the values in both inputs, even typed or auto filled. Anyway, I can't believe that I have to use this workaround instead of using ng-Model just because browser auto filled them.

Thanks in advance! :)

marvinferreira avatar Feb 26 '14 18:02 marvinferreira