You're missing a curly brace in your binding:
<li data-_id="{{category._id}" on-click="{{selectCategory}}">...
should be
<li data-_id="{{category._id}*}*" on-click="{{selectCategory}}">...
here's a working example: http://jsbin.com/gexoxi/3/edit
On Mon, Dec 1, 2014 at 10:56 PM, Yvon Thoraval <[email protected]>
wrote:
> in my template,i have :
> <li data-_id="{{category._id}" on-click="{{selectCategory}}">...
>
> in js :
> Polymer('my-categories', {
> ready: function() {
> this.categories = [
> {_id: 1, name: 'Abonnements'}
> , {_id: 2, name: 'Clés de logiciels'}
> , {_id: 3, name: 'Formulaires'}
> , {_id: 4, name: 'Groupes de nouvelles'}
> , {_id: 5, name: 'Références'}
> ];
> },
> selectCategory: function(e) {
> this.selectedCategoryId = e.target.dataset._id;
> console.log("this.selectedCategoryId = " + this.selectedCategoryId);
> // => this.selectedCategoryId = {{category._id}
> }
> });
>
>
> when i click to one element i get :
> this.selectedCategoryId = {{category._id}
> insted of a number in 1..5, why?
>
> Follow Polymer on Google+: plus.google.com/107187849809354688692
> ---
> You received this message because you are subscribed to the Google Groups
> "Polymer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/polymer-dev/b05c3bf4-3408-4030-a25f-66f12bd38156%40googlegroups.com
> <https://groups.google.com/d/msgid/polymer-dev/b05c3bf4-3408-4030-a25f-66f12bd38156%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/polymer-dev/CAJj5OwCKojFN%2Bz2_sVGmzJtoqxofWXDePvP4pU2Ywb-BVmme7g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.