Skip to content

[BUG]: Not able to make it work with google places library in Ionic #79

Description

@SumeetHindinkeri

I'm submitting a

  • [x ] Bug report

Description

I am trying to use it with get places library of google to show the dropdown of places. I tried with simple function option and function, service option but I get following error. I am getting the results in console log but before that this error popup and dropdown doesn't showup.

core.js:7376 ERROR TypeError: Cannot read property 'length' of undefined
    at AutoCompleteComponent.push../node_modules/ionic4-auto-complete/fesm5/ionic4-auto-complete.js.AutoCompleteComponent.removeDuplicates (ionic4-auto-complete.js:530)
    at AutoCompleteComponent.push../node_modules/ionic4-auto-complete/fesm5/ionic4-auto-complete.js.AutoCompleteComponent.setSuggestions (ionic4-auto-complete.js:633)
    at ionic4-auto-complete.js:317
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
    at Object.onInvokeTask (core.js:26760)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
    at push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask (zone.js:498)
    at ZoneTask.invoke (zone.js:487)
    at timer (zone.js:3070)

I am trying with following code:

    let addresses = [];
    new google.maps.places.AutocompleteService().getPlacePredictions({
      input: addressQuery,
      componentRestrictions: {},
      // bounds: defaultBounds
    }, (predictions) => {
      console.log(predictions);
      addresses = predictions;
      return addresses;
    })

Version Information

ionic4-auto-complete: 2.7.1
@angular/cli: 8.1.3

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions