Javascript 角度ng选项发送数组值

Javascript 角度ng选项发送数组值,javascript,arrays,angularjs,angularjs-ng-options,Javascript,Arrays,Angularjs,Angularjs Ng Options,我试着在我写的简单表单上使用AngularJS。 对我的使用ng选项,但在验证表单时,从select接收的值是我在数组中选择的范围,而不是我在表单中选择的实际字符串 <section id="signin" ng-controller="Sign_in"> <form method="post" action="xxxx.php"> <div id="contact"> <div class="input_label use

我试着在我写的简单表单上使用AngularJS。 对我的使用ng选项,但在验证表单时,从select接收的值是我在数组中选择的范围,而不是我在表单中选择的实际字符串

<section id="signin" ng-controller="Sign_in">
    <form method="post" action="xxxx.php">
      <div id="contact"> 
    <div class="input_label user"> 
      <label for="country">Pays</label>
    </div> 
    <select ng-options="country for country in countries" name="country" ng-model="Country"></select>
      </div> 
      <br>
      <input type="submit">
    </form>
</section>

我认为您需要应用过滤器来获取值

如果我是你,我会使用与Boostrap 3一起工作的优秀软件。您的代码将是:

  <input type="text" ng-model="selected" typeahead="country for country in countries | filter:$viewValue | limitTo:8" class="form-control">

由于某些原因,您不能将数组的值用作select using ngOptions中的值。您必须这样做:

<select name="country" ng-model="Country" >
    <option ng-repeat="country in countries" value="{{country}}">
       {{country}}
    </option>
</select>

如何验证表单?我很确定错误不是来自表单验证,无论如何,我使用PDO
$req=$bdd->prepare('INSERT INTO client_id(email、civilite、nom、prenom、date_-naissance、address、code_-posal、ville、pays)值(?,,,,,,,,,,,,,,?)或退出(print_r($bdd->errorInfo());                                     $请求->执行(数组('email'=>$email',civilite'=>$gender,'nom'=>$name,'prenom'=>$firstname,'date\u naissance'=>$birth,'address'=>$address,'code\u postal'=>$zipcode,'ville'=>$city,'pays'=>$country))这正是我想要的,非常感谢!!
<select name="country" ng-model="Country" >
    <option ng-repeat="country in countries" value="{{country}}">
       {{country}}
    </option>
</select>
<option ng-repeat="country in countries" value="{{country}}" ng-selected="country == Country">
   {{country}}
</option>