将输入类型电子邮件的值分配给另一个类型的电子邮件angularjs

时间:2016-08-22 10:30:23

标签: javascript angularjs

我正在尝试将一个类型为email的输入字段分配给angularjs中的另一个,但它无效。这是我的尝试:

<div class="row-fluid">
  <div class="control-group span12">
    <label for="email">Email</label>
    <input name="email" placeholder="" type="email" class="input-block-level" ng-model="email" required>
  </div>
</div>
<div class="row-fluid">
  <div class="control-group span12">
    <label for="email">Confirm</label>
    <input type="email" name="emailaccess" placeholder="" ng-model="{{id}}" class="input-block-level" required>
  </div>
</div>

请问哪里错了?

1 个答案:

答案 0 :(得分:1)

由于角度js具有一个名为双向绑定的强大功能,因此您需要在两个控件上使用相同的ng-modal。

<div class="row-fluid">
        <div class="control-group span12">
            <label for="email">Email</label>
            <input name="email" placeholder="" type="email" class="input-block-level" ng-model="email" required>
        </div>
    </div>
    <div class="row-fluid">
        <div class="control-group span12">
            <label for="email">Confirm</label>
            <input type="email" name="emailaccess" placeholder="" ng-model="email" class="input-block-level" required>
        </div>
    </div>