routing

When to use “client-side routing” or “server-side routing”?

試著忘記壹切 提交于 2019-11-29 19:11:06
I'm a little bit confused about this, and I feel slightly stupid asking this question, but I want to understand it. So, say I'm working with a client side web framework, like Backbone, Angular or Durandal. This framework includes routing. But I of course still have a server for database stuff, and so on, which also has routing. My question now is: When to use "client-side routing" or "server-side routing"? How is it "decided" whether routing is already performed on the client side or whether the request is first sent to the web server? I have a particularly hard time imagining this because the

How can I set a query parameter in AngularJS without doing a route?

。_饼干妹妹 提交于 2019-11-29 18:59:17
My Angular app allows the user to load an item, and when that happens I'd like to set a query string that contains the item's Id so that if the user refreshes the page (or wants to link to it), the URL is already set (there's already code in place that loads the item if the Id is present in $routeParams). How can I set that query parameter without causing a route? There are other things on the page that will get reset (including a plugin that will have to reload all of its data) if a route happens, so it's important that just the query parameter changes. In short, when I load item 123, all I

Is it possible to create routes dynamically in .NET 4?

南笙酒味 提交于 2019-11-29 18:04:45
问题 In our application we use the new .NET 4 routing system to route certain requests to other parts of the site. We are only allowed to publish our site code in late evenings which means we have to stay late at work to publish any code changes. We frequently have the need to create custom routes to support legacy links to old content and route them to the new content. These are often needed right away and as our routes are defined in compiled global.asax we reach an impasse when we need these

Override route helper methods

落花浮王杯 提交于 2019-11-29 17:10:49
问题 Question has many Comments. A URL "questions/123" shows a question. A URL: "questions/123#answer-345" shows a question and highlights an answer. 345 - is id of Answer model, "answer-345" is id attribute of HTML element. I need to override "answer_path(a)" method to get "questions/123#answer-345" instead of "answers/345" How to do it ? 回答1: All url and path helper methods accept optional arguments. What you're looking for is the anchor argument: question_path(123, :anchor => "answer-345") It's

Rails: redirect to current path but different subdomain

元气小坏坏 提交于 2019-11-29 16:57:23
问题 I think this should be fairly easy but I'm not familiar with how it's done... How do you write a before filter that would check if the current request is for certain subdomains, and if so redirect it to the same url but on a different subdomain? Ie: blog.myapp.com/posts/1 is fine but blog.myapp.com/products/123 redirects to www.myapp.com/products/123 . I was thinking something like... class ApplicationController < ActionController::Base before_filter :ensure_domain protected def ensure_domain

Routing php query using .htaccess

六月ゝ 毕业季﹏ 提交于 2019-11-29 16:50:42
I am trying to find a better solution to solve the issue. I am not using any framework like silex, Yii etc. Thus i do not have the general routing handling mechanism provided by these frameworks. My url patterns are like routing.php routing.php?action=create routing.php?action=list&id=1 and the resulting url i want to have are /routing /routing/create /routing/list/1 i have some very basic understanding of .htaccess, below is my current foundings RewriteEngine On RewriteBase /name/ RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php These codes

How do you use anchors for IDs in routes in Rails 3?

时光毁灭记忆、已成空白 提交于 2019-11-29 16:39:46
问题 Imagine a blog with posts and comments . An individual comment's URL might be posts/741/comments/1220 . However, I'd like to make the URL posts/741#1220 , or even posts/741#comment-1230 . What's the least intrusive way of doing this, so that redirect_to comment_path(my_comment) points to the correct URL? 回答1: You could simply use redirect_to post_path(comment.post, :anchor => "comment-#{comment.id}") to manually build the URL with the anchor. That way, you can still have the absolute URL to

Mass 301 redirects in ASP.NET, including pages that need to redirect to a different place depending on the query string parameters

徘徊边缘 提交于 2019-11-29 15:43:54
问题 We have several pages of our site indexed using old non-SEO friendly URLS such as http://www.domain.com/DocumentDetails.aspx?id=555. Recently we implemented routing that uses slugs stored in the database and looks up the slug to forward you to the right page using routing, for example: http://www.domain.com/Documents/Title-of-the-Document This is all well and good however we are having a hard time finding the best way to set up our 301 permanent redirects for all the links currently indexed

Angular 2 router auxiliary routes not working on redirectTo

試著忘記壹切 提交于 2019-11-29 15:09:10
I recently started a new project based on angular 2.0.0 in combination with Angular Router (V3.0.0). Thereby I have issues with the auxiliary routes. I want to split up my application in different views that appear in every state like navigation bar, main content, footer etc. So that when the user interact with the site only the part of the page that needs to be changed (f.e. the content) is changed and all other views are left as they are. Therefore I wanted to use the routers auxiliary feature as discussed in this talk: Angular Router Talk @AC2015 I set up my files as follows: app.html

how to route to css/js files in mvc.net

丶灬走出姿态 提交于 2019-11-29 14:39:47
I am trying to add an area to my application using routing in mvc.net. For controllers i added: routes.MapRoute( "Area1", // Route name "Area1/{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); how can i route the css/js files in the same way, i.e. i would like to have area1/content/site.css going to /content/site.css or to /content/area1/site.css . Thanks like this for /content/site.css if you want to always goto site.css: routes.MapRoute( "Area1", // Route name "/{action}/site.css", // URL