Pacane
Pacane

Reputation: 21481

Dart Polymer Routing

I have a single page app using Dart and Polymer. I'm trying to add a route to another page with route_hierarchical

What I've tried so far was configuring the router like this:

router = new Router()
router.root
  ..addRoute(name: 'games', path: '/games')
  ..addRoute(name: 'login', path: '/login')
  ..addRoute(name: 'home', defaultRoute: true, path: '/');
router.listen();

I've found that I can use

new Router(useFragment: ...);

to enable the hashbangs in the URLs or not. The problem is that when I don't use hashbangs, I can't access a page using the URL directly. (meaning the app routes me when I click on buttons and such). Is there a way of having sharable URLS with no hashbangs? I've seen AngularJs using something like

$locationProvider.html5Mode(true)

to remove the hashbangs and still have sharable URLs... I don't know if I really should bother having URLs without hashbangs though. I've read having them is going to give me trouble with SEO, is that right?

I'm only using Polymer and route_hierarchical right now, and didn't want to go for angular.dart just for routing.

Upvotes: 1

Views: 371

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657406

You need to use a router on the server side too when you want to use URLs without fragments.

see also

Upvotes: 1

Related Questions