Hello,
I am trying to use polymer core menu. Below is my code.On change of menu, i
am trying log the selected menu.Though it is showing in the log selected
item but it is throwing error as "Uncaught TypeError: Cannot read property
'id' of undefined " after the first selection.I am not sure where i am
going wrong.Need help...
<polymer-element name="yo-menus" attributes="">
<template>
<link rel="stylesheet" href="yo-menus.css">
<section id="midas_menus">
<core-ajax auto
url="menus.json"
response="{{menus}}"
handleas="json">
</core-ajax>
<template if="{{menus}}">
<paper-menu-button>
<paper-icon-button icon="menu" noink></paper-icon-button>
<core-menu class="menu" selected="0"
selectedItem="{{selectedMenu}}" valueattr='id'
on-core-select="{{mainMenu}}">
<template repeat="{{menu in menus}}">
<paper-item id="{{menu.name}}" label="{{menu.name}}"
></paper-item>
</template>
</core-menu>
</paper-menu-button>
</template>
</template>
</section>
<script>
Polymer('yo-menus', {
// initialize the element's model
ready: function() {
},
mainMenu : function(){
console.log("New item selected: " + this.selectedMenu.id);
}
});
</script>
</polymer-element>
Regards,
Mausumi
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/f0562018-a0d9-468c-9f3b-62701e1761f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.