Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Issues to call application service from Angular2 modal #3026


User avatar
0
jizhongqi created

Hello, When I tried to call an application service to fill a combo box in an Angular2 modal dialog it seems not working, unless we call SetTimeout method like: but if we set this timeout more then 1seconde, for emxample 2s, it doesn't look good, because there are some delay to display the combo list values, anyone got this issue? and how to solve it?


2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    According to our experience, select picker is not working very well with angular2. We used same approach, using setTimeOut in our project as well.

    You can try to give 0 as a timeout parameter. See <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/blob/master/angular/src/app/admin/shared/permission-combo.component.ts">https://github.com/aspnetzero/aspnet-ze ... mponent.ts</a>.

    Thanks.

  • User Avatar
    0
    devenderkaur created

    Hi I Have Dynamically generated DropDowns .Select picker has already called the refresh method.While retrieving data from server it is populating the record of only First Drop Down at the first load. But when i refresh the page,then it populates the records of all other Drop Downs. How can we make it filled at the first load itself??

    Below is the HTML Code:- <div *ngFor="let extend of extendedAttributeFixed" class="form-group form-md-line-input form-md-floating-label no-hint"> <select #extendedComboBox name="extendedCombo" class="form-control" [attr.data-live-search]="true" jq-plugin="selectpicker" (ngModelChange)="onChange($event,extend .id)" [(ngModel)]="examineeExtInput.ExtendedAttributeId"> <option *ngFor="let items of extendedAttributeItem | ExtendPipe:extend .id" [value]="items.id" > {{items.name}} </option> </select> </div>

    Below is the ts Code:- @ViewChild('extendedComboBox') extendedComboBox: ElementRef; setTimeout(() => { $(this.extendedComboBox.nativeElement).selectpicker('refresh'); }, 0);

    If I removes jq-plugin="selectpicker" from Dropdown then it works fine but it will become a simple Dropdown.