2016-06-21 17 views

cevap

-1
<div [hidden]="power.valid " class="alert alert-danger" style="padding: 0px;margin-bottom: 2px;"> 
      Select 
     </div> 
     <select class="form-control" required 
      ngControl="power" #power="ngForm" > 
      <option *ngFor="let p of powers" [value]="p">{{p}}</option> 
     </select> 

burada Uygulanan

<div class="form-group"> 
    <div> 
     <label for="country">Country*:</label> 
    </div> 
    <div ng-class="{'valid':country.$valid}"> 
     <select class="form-control" name='country' [(ngModel)]='fd.country' required> 
      <option *ngFor="let obj of country" [ngValue]="obj">{{obj}}</option> 
     </select> 
    </div> 
    <small *ngIf="(myForm._submitted && !country.valid && !fd.country) || (!country.valid && country.dirty) ">Required (Please select country).</small> 
</div> 
+1

ilk Bu, bu sadece doğrulamak ya da gelmez deneyin div gizler – Mese

2

ben *ngIf sözdizimi kullanmış, ancak böyle açılır üzerinde doğrulama sağlayabilir::