Questions tagged [routes]

Questions about mapping URLs to Controllers and Actions.

MVC web application (like Ruby on Rails, ASP.NET MVC, etc) uses routes to map an arbitrary URL to a specific controller/action.

For example

http://example.com/foo/bar/23

Might pass an id 23 to controller foo, action bar.

Unusual URLs could also be mapped

Given controller places and intended action list, we can use routes to allow this URL:

http://example.com/my/places
32975 questions
655
votes
32 answers

How to detect a route change in Angular?

I am looking to detect a route change in my AppComponent. Thereafter I will check the global user token to see if the user is logged in so that I can redirect the user if the user is not logged in.
AngularM
  • 15,982
  • 28
  • 94
  • 169
397
votes
31 answers

No route matches "/users/sign_out" devise rails 3

I've installed devise on my app and applied the following in my application.html.erb file:
<% if user_signed_in? %> Signed in as <%= current_user.email %>. This cannot be cheese? <%= link_to 'Sign out',…
vich
  • 11,836
  • 13
  • 49
  • 66
368
votes
10 answers

Send data through routing paths in Angular

Is there anyway to send data as parameter with router.navigate? I mean, something like this example, as you can see the route has a data parameter, but doing this it's not working: this.router.navigate(["heroes"], {some-data: "othrData"}) because…
Motomine
  • 4,205
  • 5
  • 20
  • 23
325
votes
18 answers

S3 Static Website Hosting Route All Paths to Index.html

I am using S3 to host a javascript app that will use HTML5 pushStates. The problem is if the user bookmarks any of the URLs, it will not resolve to anything. What I need is the ability to take all url requests and serve up the root index.html in my…
Mark Nutter
  • 5,449
  • 4
  • 15
  • 12
254
votes
9 answers

A potentially dangerous Request.Path value was detected from the client (*)

I am receiving the rather self explanatory error: A potentially dangerous Request.Path value was detected from the client (*). The issue is due to * in the request URL: https://stackoverflow.com/Search/test*/0/1/10/1 This url is used to populate…
user336245
248
votes
13 answers

How to get current route in Symfony 2?

How do I get the current route in Symfony 2? For example, routing.yml: somePage: pattern: /page/ defaults: { _controller: "AcmeBundle:Test:index" } How can I get this somePage value?
IlyaDoroshin
  • 4,659
  • 4
  • 22
  • 26
247
votes
14 answers

How can I find out the current route in Rails?

I need to know the current route in a filter in Rails. How can I find out what it is? I'm doing REST resources, and see no named routes.
luca
  • 12,311
  • 15
  • 70
  • 103
245
votes
8 answers

How/when to use ng-click to call a route?

Suppose you are using routes: // bootstrap myApp.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) { $routeProvider.when('/home', { templateUrl: 'partials/home.html', controller:…
244
votes
10 answers

Is it possible to make an ASP.NET MVC route based on a subdomain?

Is it possible to have an ASP.NET MVC route that uses subdomain information to determine its route? For example: user1.domain.example goes to one place user2.domain.example goes to another? Or, can I make it so both of these go to the same…
Dan Esparza
  • 28,047
  • 29
  • 99
  • 127
226
votes
8 answers

Angular 2 router no base href set

I am getting an error and can't find why. Here is the error: EXCEPTION: Error during instantiation of LocationStrategy! (RouterOutlet -> Router -> Location -> LocationStrategy). angular2.dev.js:23514 EXCEPTION: Error during instantiation of…
Jason Spick
  • 6,028
  • 13
  • 40
  • 59
216
votes
3 answers

Failed to instantiate module [$injector:unpr] Unknown provider: $routeProvider

I received this error upon upgrading from AngularJS 1.0.7 to 1.2.0rc1.
Scotty.NET
  • 12,533
  • 4
  • 42
  • 51
206
votes
10 answers

How to open a link in new tab using angular?

I have an angular 5 component that needs to open a link in new tab, I tried the following: page link when I open the link, the application gets slow and opens a route…
AlejoDev
  • 4,345
  • 9
  • 36
  • 67
193
votes
14 answers

Change route params without reloading in Angular 2

I'm making a real estate website using Angular 2, Google Maps, etc. and when a user changes the center of the map I perform a search to the API indicating the current position of the map as well as the radius. The thing is, I want to reflect those…
Marcos Basualdo
  • 2,580
  • 3
  • 18
  • 11
192
votes
18 answers

Passive Link in Angular 2 - equivalent

In Angular 1.x I can do the following to create a link which does basically nothing: My Link But the same tag navigates to the app base in Angular 2. What is the equivalent of that in Angular 2? Edit: It looks like a bug in the…
s.alem
  • 12,579
  • 9
  • 44
  • 72
177
votes
6 answers

Rails 3: I want to list all paths defined in my rails application

I want to list all defined helper path functions (that are created from routes) in my rails 3 application, if that is possible. Thanks,
wael34218
  • 4,860
  • 8
  • 44
  • 62
1
2 3
99 100