NgModel problem with browser auto fill.
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 yes, this is rather unfortunate but there is no perfect salutation here till browsers emit proper events autocomplete. There is a lot more discussion / details in https://github.com/angular/angular.js/issues/1460
Closing as duplicate of #1460
Thank you @pkozlowski-opensource !!!!!