angular不尊重我所有必需的字段

时间:2015-04-08 03:21:16

标签: angularjs

在我的页面中,除了底部的user.productNumber输入外,一切正常。我的意思是所有"所需"字段保持"创建帐户"按钮已禁用,但它正在忽略productNumber输入。我怎样才能使这个工作?

<ion-view title="Sign Up">

  <ion-content>
    <form name="signUpForm">
      <div class="list">
        <label class="item item-input item-stacked-label">
          <input data-ng-model="user.email" data-ng-pattern="/^[_a-z0-9]+(\.[_a-z0-9]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/" type="email" placeholder="user@mail.net" required>
        </label>

        <label class="item item-input item-stacked-label">
          <input data-ng-model="user.password" type="password" placeholder="password" required>
        </label>

        <label class="item item-input item-stacked-label">
          <input data-ng-model="user.passwordAgain" type="password" placeholder="password (again)" required>
        </label>

        <li class="item item-checkbox">
          <label class="checkbox">
            <input data-ng-model="user.newsletter" type="checkbox" checked>
          </label>
          Weekly Newsletter
        </li>

        <label class="item item-input item-stacked-label">
          <input data-ng-modal="user.productNumber" data-ng-pattern="/^[a-zA-Z0-9-]{8}$/" type="text" placeholder="Product Number" required>
        </label>
        <button data-ng-click="createAccountClick()" data-ng-disabled="signUpForm.$invalid" class="button button-full button-positive">
          Create Account
        </button>
      </div>
    </form>
  </ion-content>
</ion-view>

1 个答案:

答案 0 :(得分:2)

这是因为您使data-ng-model误导了data-ng-modal

简单地改变:

data-ng-modal="user.productNumber"

data-ng-model="user.productNumber"