Angularjs Chrome autocomplete dilemma

后端 未结 15 1714
野性不改
野性不改 2020-12-05 06:56

I have a simple login form which works just peachy unless you use Chrome\'s auto complete feature.

If you start typing and use the auto complete feature and it auto

15条回答
  •  遥遥无期
    2020-12-05 07:15

    I had the same issue and found a very simple solution that just uses jQuery to grab the value on submit. In my controller I have the following:

    $scope.username = "";
    $scope.password = "";
    
    $scope.login = function(){
        $scope.username = $("#username").val();
        $scope.password = $("#password").val();
        // Proceed as normal
    };
    

    There are some downsides, if you need to do validation etc but otherwise it's fine for smaller forms like this.

提交回复
热议问题