1
votes

I have create a Polymer based Dashboard which I want to integrate with my Laravel site. My Dashboard is working fine but I have issues with routing in Polymer.

I want my Dashboard to reside at:

http://example.com/dashboard

I have set up my Laravel route as follows:

Route::get('dashboard',function(){
  return View::make('polymer.dashboard');
});

and my dashboard urls should be like:

http://example.com/dashboard/#!/feedbacks

But, I am confused about what setting to make in app.js. Current app.js:

// Sets app default base URL
  app.baseUrl = '/';
  if (window.location.port === '') {  // if production
    // Uncomment app.baseURL below and
    // set app.baseURL to '/your-pathname/' if running from folder in production
    //app.baseUrl = '/dashboard/';
  }

Under these settings, when I navigate to http://example.com/dashboard, when Polymer finishes loading, the url changes to http://example.com/.

1
shouldn't you just use app.baseUrl = '/dashboard'; ?Didier Sampaolo
I tried that but it is not working.Rajat Saxena

1 Answers

2
votes

If you haven't told the router to not use hashbangs then navigating to /dashboard won't work, it's expecting #!. You'll need to go into app/elements/routing.html and remove the line that says hashbangs: true. You'll also need to set the baseUrl to /dashboard/. Your server will also need to always return the index.html for any URL that starts with dashboard. So if the user tries to go to example.com/dashboard/feedback it should send down the index.html page again.

After you've made the change to routing.html, go into the devtools settings and enable Disable cache (with dev tools open). Then reload the app to make sure it isn't serving a cached version of the file.