角度dart书签视图 [英] Angular dart bookmarking views

查看:127
本文介绍了角度dart书签视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据我的经验,Angular Dart与后端服务器实现无关。它不在乎你的服务器是在java,ruby还是别的什么。角度飞镖具有视图的概念,并且具有处理它们之间的路由的模块。这些路由也会在浏览器更改视图时修改地址栏。

It is my experience that Angular Dart is agnostic to your backend server implementation. it doesn't care if your server is in java, ruby or whatever. Angular dart has the concept of views and has a module that deals with routing between them. these routes also modify the address bar of the browser when it changes views.

我遇到了这个问题。虽然角度路由器模块将改变地址栏,因为所述路线实际上不存在到后端服务器,并且因此将总是发出404响应。

I have come across this issue. Though the angular router module will change the address bar, because said route doesn't actually exist as far as the backend server is concerned, and as such will always issue a 404 response.

如果是这种情况,那么我发现通过角度路由到不同页面的能力是无意义的。也许我也可以用更传统的面向服务器的方式在页面之间转换,而不是在角色之间转换。

If such is the case, then I find the ability to route to different pages via angular to be pointless. Might as well I code in a more traditional server oriented fashion to transition between pages, than to sue angular.

是否有缺少的东西?

推荐答案

您可以使用 usePushState:false ,则只更改URL的(客户端)本地部分。

请参阅 https://github.com/angular/angular.dart.tutorial/blob/master/Chapter_06/web/main .dart#L27

哈希后的此部分从不会发送到服务器。

这可能会导致SEO的一些额外工作。

You can use usePushState: false then only the (client) local part of the URL is changed.
see https://github.com/angular/angular.dart.tutorial/blob/master/Chapter_06/web/main.dart#L27
This part after the hash is never sent to the server.
This might cause some additional work for SEO.

http://example.com/index.html#someRoutePath/anotherRoutePath

或者您可以配置您的服务器,使每个请求独立于请求中的路径进行处理,并使用路由包服务器端。

or you can configure your server in a way that each request is handled independent of the path in the request and use the route package server side too.

另请参阅 http://stackoverflow.com/a/17909743/217408

这篇关于角度dart书签视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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