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

placeChangedCallback and focusOutCallback actions not being called #76

Closed
yefan15 opened this issue Sep 27, 2018 · 3 comments
Closed

placeChangedCallback and focusOutCallback actions not being called #76

yefan15 opened this issue Sep 27, 2018 · 3 comments

Comments

@yefan15
Copy link

yefan15 commented Sep 27, 2018

When I declare placeChangedCallback=(action "placeChanged") I get TypeError: Cannot read property 'apply' of undefined. and when I use placeChangedCallback='placeChanged' it doesn't get called at all. Is there something I need to do special if I am creating a search bar component that is going to be used else where? The logic for the action is defined in my component js file. I am also noticing the same behavior with the focusOutCallback

Here is a snippet:

Template (search-bar-address):

<p id=“message”>Message: {{message}}</p>

<p>Full adddress from JSON sent to the callback: {{{fullAddress}}}</p>

<p>Clean string: {{cleanFullAddress}}</p>

<p> Model address: {{address}}</p>

<div id=“search-bar” data-google-auto="{{googleAuto}}">

<label class=“visually-hidden” for=“input-search”>Add a new address</label>

{{place-autocomplete-field

id=input-searchvalue= address

handlerController= this

placeholder=Add a new addressinputClass=place-autocompleteinputplaceChangedCallback=addressChangedfocusOutCallback=donerestrictions=googleMapsRestrictions

withGeoLocate= true

}}

<pre style=“font-size: 6px;”>

{{placeJSON}}

</pre>


googleMapsRestrictions: { country: ‘us’, }, 
fullAddress: null, 
googleAuto: null,
 action: { done()
{ console.log(“Reached”); }, 
addressChanged(place) { console.log("***********"+place);

  }
}

Where it is implemented

 {{search-bar-address
          id="search-bar-component"
          }}
@dmuneras
Copy link
Collaborator

Hey @yefan15,

It is a little bit complicate to read the code you pasted, but, I created this simple gist that show you how to use it. It looks super simple, but it should work:

https://gist.github.com/dmuneras/1f0de66d2240c862537cb49372804acf

Basically, as long as you have defined the action in the component it should work. As personal comment, just try to avoid using that handlerController, I made a big mistake adding that when I create this project and it is very likely that I am going to remove it in the near future.

Let me know if this help you.

Best regards,
Daniel.

@yefan15
Copy link
Author

yefan15 commented Oct 4, 2018

Yes Daniel this was very helpful, thanks so much!

@dmuneras
Copy link
Collaborator

dmuneras commented Oct 4, 2018

No problem @yefan15, I am glad it helped you.

@dmuneras dmuneras closed this as completed Feb 6, 2019
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