0

I have this simple setup:

index:

<app-router>
    <app-route path="/home" element="home-element" bindRouter></app-route>
    <app-route path="/test"  element="test-element" bindRouter></app-route>
</app-router>

test-element:

<dom-module id="test-element">
    <template >
        <a href="#/home">Home</a>
    </template>
    <script>
        addEventListener('WebComponentsReady', function() {
            Polymer({
                is: "test-element"
            });
        });
    </script>
</dom-module>

And home-element just says "hello world" My problem is the url gets updated but the page does not change. Also when I type any url directly to the browser I need to hit "enter" two times to force it to refresh in order for it to work.

Is this a bug? app-controller dosen't work with polymer 1.x? Or am I doing something wrong?

Alejandro
  • 1,159
  • 3
  • 16
  • 30

1 Answers1

0

For latest Polymer release, you can use dna-router. It works with Polymer 1.x. You can define states, routes and views in HTML only.

For state

<dna-new-state state='home' route='/home/:id'></dna-new-state>

For views

<dna-view
state='home'
element='home-template'></dna-view>

For more information, visit: https://github.com/Saquib764/dna-router

Enjoy :)

codedemon
  • 84
  • 4