AngularJS - using a form and auto-completion

前端 未结 2 671
萌比男神i
萌比男神i 2021-01-06 08:23

I have the following code in a partial page used for login...

2条回答
  •  花落未央
    2021-01-06 09:05

    A nice thing about autocomplete is that it leaves the form $pristine.

    You can do a simple check and get the value when needed:

    if($scope.[form_name].$pristine){
       var input document.getElementById([input_id]);
       var input_value = input.value
    }
    

    You can then submit the value or replace it e.g $scope.[module] = input.value

提交回复
热议问题