如何禁用子输入?

时间:2017-05-29 15:14:21

标签: angular

我有父组件: HTML:

<select class="form-control" type="text" required [disabled]="populateData">
      <option value=""></option>
       <option *ngFor ="let contact of contacts" [value]="contact.id">{{contact.id}} - {{contact.customerName}}, {{contact.ptechnologyName}}, {{contact.mainlocationName}}  </option>
 </select>  

TS:

   populateData: Boolean = true;

在该组件内部我有子组件:

TS:

 <app-user-detail></app-user-detail>

HTML:

 <div class="col-md-6">
     <div class="form-group">
        <label>Broj</label>
        <input type="text" class="form-control-full" placeholder="" [(ngModel)]="prepaidDetails.mobile" [ngModelOptions]="{standalone: true}" [disabled]="populateData">
      </div>
 </div>

现在我希望当我将父组件populateData更改为true以在子组件中获取它时。有什么建议吗?

0 个答案:

没有答案