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

Binding the actual selection #131

Open
Alienuser opened this issue Jun 18, 2015 · 2 comments
Open

Binding the actual selection #131

Alienuser opened this issue Jun 18, 2015 · 2 comments

Comments

@Alienuser
Copy link

Hello together,

i struggled with the folowing idea.

In my polymer-app i have the folowing:

<template is="dom-bind" id="app">
[...]
<my-navigation-menu selected="{{router}}"></my-navigation-menu>
[...]
<app-router selected="{{router}}" trailingSlash="ignore">
                    <app-route path="/login" import="[...].html"></app-route>
                    ...
                    <app-route path="/test" import="[...].html"></app-route>
                </app-router>
</template>

and my my-navigation-menu looks like

<paper-menu class="list" selected="{{router}}" on-iron-select="onMenuSelect">
<a href="#/login">
                <iron-icon icon="login"></iron-icon>
                <span>Login</span>
            </a>
<a href="#/test">
                <iron-icon icon="test"></iron-icon>
                <span>Test</span>
            </a>
</paper-menu>

But the value of router is always "undefined". Is it possible to access the active value from <pp-router?

Thank you!

@Alienuser
Copy link
Author

Does anyone has the same problem?

@shanika
Copy link

shanika commented Jul 29, 2015

I used on-state-change event of app-router element to get notified and change the selected menu item depending on the selected path. Not sure if there's a better way. I tried it with polymer 0.5 but it should work same in Polymer 1.0 as well.

routeStateChange : function (e) {
if(e.detail.path=="/login"){
this.$.list.selected = 0;
}
}

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