Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

autocomplete not working for input if data is dynamically bind through webservice #351

Open
prasadsawant12 opened this issue Sep 28, 2018 · 3 comments

Comments

@prasadsawant12
Copy link

I am implementing autocomplete for input text box.
my html is--->

    <mz-input-container class="input-field col s12">
      <i class="icon-vkv-icons-set-28 prefix"></i>
      <input mz-input mz-validation [formControl]='pinCodeCtrl' id="pinCode" type="text"
             [errorMessageResource]="errorMessageResources.pinCode" [autocomplete]="pincodes"
             [label]="'Enter your pincode'" />
    </mz-input-container>

Here if i bind pincode statically then auto complete works.

but if i try to fill pin code dynamically using web service then it dont work even if static and dynamic pincode collection are same .

My controller is -- >
ngOnInit() {
this.pincodeDataService.getPincodeList(pincodeInitials)
.subscribe((data) => {
this.pincodes1 = data;
this.pincodes1.forEach(s => {
if (this.pincodes["data"] == undefined)
this.pincodes["data"] = {};
this.pincodes["data"][s.pin_code] = s.pin_code_id;
})
}

is there any demo or way which will show dynamic autocomplete.

@niknak88
Copy link

niknak88 commented Feb 20, 2019

up
I'm the same issue

@prasadsawant12
Copy link
Author

You have to manually fire the autocomplet method of ngx using view child

@niknak88
Copy link

@prasadsawant12 have you an example ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants