离子形式验证

时间:2018-02-05 13:22:15

标签: angularjs ionic-framework

我在 ionic 1 中创建了一个简单的表单,但验证工作不正常。即使我在输入字段中提到“required”,它也没有提供必需的弹出窗口,也没有“ng-show”显示任何内容。

View.html:

    <ion-view class="forms-view">
      <ion-nav-buttons side="left">
        <button menu-toggle="left" class="button button-icon icon ion-navicon"></button>
      </ion-nav-buttons>
      <ion-nav-title>
        <span>Index Card</span>
      </ion-nav-title>
      <ion-content ng-controller="ValidationCtrl">
       <div class="list card">

        <form name="indexcard" class="list" novalidate> 
         <div class = "item">


            <label class="item item-input item-stacked-label" name="dov" style="border-bottom: solid 1px #ccc;">
              <i id="iconcolor" class="icon ion-calendar"></i> <span class="input-label" style="color:#ffab00">Date</span>
              <input type="date">
            </label>

            <label class="item item-input" name="patientname" style="border-bottom: solid 1px #ccc;">
              <i id="iconcolor" class="icon ion-person placeholder-icon"></i>
              <input  type="text" placeholder="Patient Name" ng-model="patientname" required />
              <span ng-show="indexcard.patientname.$error.required">The Patient Name is required.</span>
            </label>


             <label class="item item-input" name="sdwname" style="border-bottom: solid 1px #ccc;">
               <i id="iconcolor" class="icon ion-person placeholder-icon"></i>
               <input  type="text" placeholder="S/W/D" ng-model="sdwname" required/>
               <span ng-show="indexcard.sdwname.$touched && indexcard.sdwname.$invalid">The name is required.</span>
            </label>


            <center>
              <button type="submit" class="button button-dark" ng-click="submit(patientname)">
              Submit
              </button>
            </center>

0 个答案:

没有答案