Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants