飞镖高分子路由 [英] Dart Polymer Routing

查看:156
本文介绍了飞镖高分子路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用飞镖和聚合物的单页的应用程序。我想一个路由添加到另一个页面, route_hierarchical

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: ...);

,以便能够在URL或不hashbangs。的问题是,当我不使用hashbangs,我不能直接使用该URL访问一个页面。 (即该应用的路线我,当我点击按钮等等)。有有没有hashbangs共享URL的方式吗?我见过使用类似AngularJs

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)

要删除hashbangs,仍然有可共享的网址...我不知道如果我真的应该去的网址不hashbangs虽然。我读过让他们要给我捣乱与搜索引擎优化,是这样吗?

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?

我只使用聚合物和route_hierarchical现在,并没有想要去angular.dart只是路由。

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

推荐答案

您需要的时候要使用的URL没有片段用在服务器端的路由器了。

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

又见

  • httpd.conf and HTML5 pushstate()
  • Angular dart bookmarking views
  • AngularJS routing without the hash '#'

这篇关于飞镖高分子路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆