esbanarango / ember-place-autocomplete

Ember cli addon to provide a component that uses Google Places API to autocomplete place information when people write their address
MIT License
63 stars 62 forks source link

Interested in ability to enable/disable autocomplete from property? #55

Closed PeterCadwell closed 7 years ago

PeterCadwell commented 7 years ago

What does disabled attribute do in the component? I'd like for a way to enable/disable this component via the disabled property.

dmuneras commented 7 years ago

Hey @PeterCadwell,

SHORT ANSWER: disables the input. You can pass the disabled param (set as true) and the input is going to be disabled. It is just the common disabled option of the Ember input helper:

   {{place-autocomplete-field
    value= model.address2
    handlerController= this
    inputClass= 'place-autocomplete--input-2'
    inputId='place-autocomplete--input-2'
    placeChangedCallback="placeChangedSecondInput"
    restrictions=restrictions
    disabled=true -> THIS ONE
  }}

https://cl.ly/2W2i1g2l2L3y

dmuneras commented 7 years ago

BTW, @PeterCadwell you give an idea, maybe if the input is disabled, the component should stop listening to the google events...

jakiestfu commented 7 years ago

@dmuneras We'd like to add support for that logic. Would you accept a PR for this?

dmuneras commented 7 years ago

@jakiestfu sure!, you can implement it and I will be glad to review it and merge it.

dmuneras commented 7 years ago

I am going to close this, we already addressed the question and we are waiting for the contribution. :D