PrimeNG禁用p-autocomplete控制

时间:2018-10-15 09:55:08

标签: angular primeng

我有一个要求,我需要用“加载..”禁用PrimeNG的p-autoComplete控件,直到数据来自调用方法所预订的可观察对象。谁能帮忙解决这个问题?

.html文件:

 <p-autoComplete #autoComplete1 id="resourceGroupNameInput" formControlName="resourceGroupNameControl" [suggestions]="filteredResourceGroupNames" (completeMethod)="FilterResourceGroups($event)" field="name" [size]="30" placeholder="Resource Group Name" [minLength]="0" forceSelection="true" [dropdown]="true" dropdownMode="current" (onDropdownClick)="handleResourceGroupDropdownClick($event)" class="not-required">
 <template let-resourceGroupName pTemplate="item">
    <div class="ui-helper-clearfix" style="border-bottom:1px solid #D5D5D5; width: 100%">
       <div>{{resourceGroupName}}</div>
    </div>
 </template>
</p-autoComplete>

.ts文件:

this._subscriptionService.getSubscriptionByName(subscriptionName).subscribe(
                res => {
                    console.log("res:" + JSON.stringify(res));
                    var subscriptionId = res.result.subscriptionId;
                    console.log("subscription id: " + subscriptionId);
                    this._resourceGroupService.GetResourceGroupForSubscription(subscriptionId).subscribe(
                        response => {
                            var result = response;
                            var rgNames = result.map(r => r.name);
                            this.filteredResourceGroupNames = rgNames;
                            this.resourceGroupNameControlBusy = false;
                        },
                        error => {
                            this._toaster.Notify("error", "An error occured while fetching the existing Resource Group details");
                        }
                    );
                },
                error => {
                    this._toaster.Notify("error", "An error occured while fetching the existing Subscription details");
                }
            )

enter image description here

0 个答案:

没有答案