阅读背景:

如果没有特定元素可见,则Angular2显示元素

来源:互联网 

HTML:

<form>
  <div class="row">
    <div class="col">
      <div class="form-group">
        <label for="registerFormEmail">Email Address</label>
        <input type="text" class="form-control" placeholder="Enter your email address..."
               [(ngModel)]="registerEmail" name="field" #email="ngModel" email>
        <p *ngIf="email.errors?.email">Invalid Email</p>
      </div>
    </div>
    <div class="col"></div>
  </div>

  <div class="row">
    <div class="col">
      <div class="form-group">
        <label for="registerFormBattletag">Battletag</label>
        <input type="text" class="form-control" placeholder="Enter your Battletag..."
               [(ngModel)]="registerBattletag" name="registerFormBattletag" ngControl=”battletag” #btag="ngModel" pattern="[a-zA-Z]+[#][0-9]{4}$">
        <p *ngIf="btag.errors?.pattern">Invalid Battletag</p>
      </div>
    </div>
    <div class="col"></div>
  </div>

  <div class="row">
    <div class="col">
      <div class="form-group">
        <label for="registerFormPassword">Password</label>
        <input type="password" class="form-control" placeholder="Enter your password..."
               [(ngModel)]="registerPassword" name="registerFormPassword" #password="ngModel" [minlength]="6">
        <p *ngIf="password.errors?.minlength">Invalid Password</p>
      </div>
    </div>
    <div class="col">
      <div class="form-group">
        <label for="registerFormConfirmPassword">Confirm Password</label>
        <input type="password" class="form-control" placeholder="Confirm your password..."
               [(ngModel)]="registerConfirmPassword" name="registerFormConfirmPassword" #confirmPassword="ngModel" [equalTo]="password">
        <p *ngIf="confirmPassword.errors?.equalTo">equalTo error</p>
      </div>
    </div>
  </div>

  <button type="submit" class="btn btn-primary"
          (click)="register(registerEmail, registerPassword)">Register</button>
</form>
<form>
  <div class="row">
    <div cla



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: