routing

Symfony2: URLs with trailing slash and an optional parameter

大兔子大兔子 提交于 2019-12-07 01:18:23
问题 I want all URLs in my application to have a trailing slash. I have the following route in my route.yml: foo_route: pattern: /foo/{page}/ defaults: { _controller: FooBundle:Foo:list, page: 1 } requirements: page: \d+ Requests to '/foo/1/' work fine, however requests to '/foo/' are not matched because of the trailing slash in the URL pattern. How can I define routes with trailing slashes and an optional parameter? I am aware I can define 2 different routes for the two cases, but I want to avoid

ASP.NET MVC Routing with a controller named “PropertiesController” [closed]

十年热恋 提交于 2019-12-07 01:16:36
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I'm having a tricky issue (bear with me as I'm new to MVC) with trying to use a controller (and a route subsequently) with the name PropertiesController. I believe this is because there is a directory (which I can't really remove) called "Properties" in my solution. Is there a way round this? The route setup is

Using Rails 5 (the API flag) and getting no route error despite route declared

空扰寡人 提交于 2019-12-07 01:15:13
问题 This is my controller: class Api::V1::UsersController < ApplicationController respond_to :json def show respond_with User.find(params[:id]) end end This is my routes.rb require 'api_constraints' Rails.application.routes.draw do devise_for :users # Api definition namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' }, path: '/' do scope module: :v1, constraints: ApiConstraints.new(version: 1, default: true) do resources :users, :only => [:show] end end end This is my

Route module on subdomain in Zend Framework

别来无恙 提交于 2019-12-06 23:42:40
I'm having trouble getting the Zend_Controller_Router_Route_Hostname to work properly. I'm using Zend Framework 1.9.4 In my config I have: resources.router.routes.www.type = "Zend_Controller_Router_Route_Hostname" resources.router.routes.www.route = ":module.domain" resources.router.routes.www.defaults.module = "frontend" resources.router.routes.www.chains.index.type = "Zend_Controller_Router_Route" resources.router.routes.www.chains.index.route = ":controller/:action/*" resources.router.routes.www.chains.index.defaults.controller = "index" resources.router.routes.www.chains.index.defaults

Change URL without transition

落花浮王杯 提交于 2019-12-06 22:44:48
问题 I have a question concerning the Ember routing system. In my Ember-App, I have a simple leaflet fullscreen map. The center and zoom level of this map are coming from the URL query parameters. Now it would be nice to have a simple way to keep this query parameters in sync with the map position. So when somebody moves the map, I would like to change the url query parameters to the new values. When I use a simple transitionTo , I start a loop of changing the map and updating the query parameters

ASP.NET MVC Html.BeginForm Problem

你说的曾经没有我的故事 提交于 2019-12-06 21:14:59
问题 I have a partial view: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<DomainModel.Entities.Product>" %> <div class="item"> <h3><%= Model.Name %></h3> <%= Model.Description %> <% using (Html.BeginForm("AddToCart", "Cart")) { %> <%= Html.Hidden("ProductID") %> <%= Html.Hidden("returnUrl", ViewContext.HttpContext.Request.Url.PathAndQuery) %> <input type="submit" value="+ Add to cart" /> <% } %> <h4><%= Model.Price.ToString("c")%></h4> </div> And here is the html that gets

AngularJS “#!” on url

纵饮孤独 提交于 2019-12-06 20:52:32
问题 someone knows what "#!" Means. on the url? I was working until then this appears,I had a "#" always in the url and would like to keep it that way. Currently routing is not working anymore,probably because of this url change. It's part of a business project, i don`t want to change to html5Mode. I tried to use: $locationProvider.hashPrefix(""); Even correcting the url in this way routing is having problems 回答1: Thats called hash-bang . To fix this use : angular.module('yourApp', []) .config(['

Angular2 is there a way to get a list of routes out of the Router?

杀马特。学长 韩版系。学妹 提交于 2019-12-06 20:06:14
问题 What I would like to do is dynamically build my navigation by iterating through a list of configured routes in Angular2. I cannot seem to find anywhere in the Router where I can access the configured routes. Has anyone tried anything like this? I looked into the Router 's registry property but it doesn't seem to have anything usable. @Component({ selector: 'my-app' }) @View({ directives: [ROUTER_DIRECTIVES, CORE_DIRECTIVES], template: ` <h1>Routing Example</h1> <div> <div> <b>Main menu: </b>

controller path not found for static images? asp.net mvc routing issue?

醉酒当歌 提交于 2019-12-06 18:19:21
问题 I have an image folder stored at ~/Content/Images/ I am loading these images via <img src="/Content/Images/Image.png" /> Recently, the images aren't loading and I am getting the following errors in my error log. What's weird is that some images load fine, while others do not load. Anyone have any idea what is wrong with my routes? Am I missing an ignore route for the /Content/ folder? I am also getting the same error for favicon.ico and a bunch of other image files... <Fatal> -- 3/25/2010 2

How to fix broken devise routing under journey 1.0.4

Deadly 提交于 2019-12-06 16:22:21
I began troubleshooting my "sudden" broken routes problem in this SO question: Devise /users/sign_in redirecting to wrong controller and with help I was able to isolate the issue to the upgrade from journey 1.0.3 to 1.0.4 that occurred when I updated to rails 3.2.7. As you know, we need to be at rails 3.2.8, to apply important security fixes, but this means I must use journey 1.0.4, which breaks my devise routes. For instance, my custom new_user_session route is welcome#welcome, but it is being decoded to devise/welcome#welcome which does not exist. Has anybody else run into this love triangle