我在使用飞镖和聚合物的单页的应用程序。我想一个路由添加到另一个页面, 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文件和HTML5 pushState的() 角镖书签意见 AngularJS没有#'#' 路由 httpd.conf and HTML5 pushstate() Angular dart bookmarking views AngularJS routing without the hash '#'