将在文本字段中输入的值传输到另一个angularJs

时间:2016-07-29 14:11:23

标签: javascript html angularjs

我正在尝试将输入文本字段的值传输到angularjs中的另一个,这是我的尝试,但它无法正常工作

<label>Email Address:</label>
        <input type="email" name="userEmail" ng-model="email" required />

          <span class="invalid" ng-show="myForm.userEmail.$error.required">Your email is required</span>
         <br>

         <input type="email" name="emailAccess" ng-model="{{email}}" required />

请帮助!

2 个答案:

答案 0 :(得分:3)

<label>Email Address:</label>
        <input type="email" name="userEmail" ng-model="email" required />

          <span class="invalid" ng-show="myForm.userEmail.$error.required">Your email is required</span>
         <br>

         <input type="email" name="emailAccess" ng-model="email" required />

从上一个删除{{和}}。

答案 1 :(得分:0)

对于双向传输,请使用不带括号的ng-model。

<input type="email" name="userEmail" ng-model="email" required />
<input type="email" name="emailAccess" ng-model="email" required />