routing

How to redirect to previous page from multiple places?

狂风中的少年 提交于 2019-12-12 18:42:48
问题 I'm likely missing something really simple here... Say I have model called Option . I then list these options in the view, with Enable / Disable buttons that lead to a controller action which then enables or disables that particular Option . If the list is only in one place, I know just to call redirect_to or render to have the user go back to correct page, since there's only one. What if the same list is in multiple places? Meaning, if there's only one controller with enable / disable

Routing not working in Angular2

守給你的承諾、 提交于 2019-12-12 18:24:53
问题 My Routing isn't working in Angular2, to demonstrate the point, I have put the same component as the destination for both the root of my site and /login . The component works at http://localhost:3000 , but at http://localhost:3000/login , I just get a notice "Cannot GET /login". app.component.ts: import { Component } from 'angular2/core'; import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from 'angular2/router'; import {TodoService} from './todo/services/todo.service'; import {

Angular2, relative navigation (two levels back ../../)

别来无恙 提交于 2019-12-12 18:16:55
问题 I have a back button in my application, which navigates relatively some levels back. In case of one level this.router.navigate(['..'], { relativeTo: this.route }); it works perfectly (resulted route url: http://localhost:3000/three/two/one ). In case of two level back rel. navigation this.router.navigate(['..', '..'], { relativeTo: this.route }); router navigates two levels back, BUT the resulted route url looks now like http://localhost:3000/three/two/ (tailing slash, which is not correct).

ASP.NET MVC Routing not Working in Virtual Directory

淺唱寂寞╮ 提交于 2019-12-12 16:35:55
问题 I have an asp.net mvc 2 app (using .net 4.0) that isn't routing correctly when hosted in a virtual directory. I have the following simple routing rule: routes.MapRoute( "Default", // Route name "{action}", // URL with parameters new { controller = "accounts" } // Parameter defaults ); I'm trying to resolve http://mydomain.com/accounts/new. Where "accounts" is a virtual directory. If I put the app in the root of an IIS website it routes fine for http://mydomain.com/new, but if I put the app in

Howto test Custom Json Objects with Spray Routing

时光怂恿深爱的人放手 提交于 2019-12-12 14:22:59
问题 I'm creating a Rest API with spray-routing on top of mongodb for some CRUD operations, this all works fine, expect whenever I try to test it with specs2 the following specification class RestServiceSpec extends Specification with Specs2RouteTest with RoutingRestService // database initialization removed for clarity "The rest service" should "have a player called 'Theo TestPlayer' in the db" in { Get("/api/1.0/player/" + player1._id) ~> restRoute ~> check { entityAs[Player] must be equalTo

Check for 401 then redirect Angularjs but only on certain routes

£可爱£侵袭症+ 提交于 2019-12-12 14:10:17
问题 I've got a nice angular service that checks to see if a user is logged in by looking to see if the server returns a 401 error message. If it does, the user is redirected to a login page. This works well, but the issue is that its completely global for all of my pages. I have a special route that resides at /explore (using UI-router btw) that I want to ignore any 401s and show the page anyway without redirecting to the login page. How would I go about making this exception for /explore ? My

Best way to format a query string in an asp.net mvc url?

北城余情 提交于 2019-12-12 13:24:26
问题 I've noticed that if you sent a query string routevalue through asp.net mvc you end up with all whitespaces urlencoded into "%20". What is the best way of overriding this formatting as I would like whitespace to be converted into the "+" sign? I was thinking of perhaps using a custom Route object or a class that derives from IRouteHandler but would appreciate any advice you might have. 回答1: You could try writing a custom Route: public class CustomRoute : Route { public CustomRoute(string url,

MVC and AngularJS Routing - 403.14 - Forbidden

别说谁变了你拦得住时间么 提交于 2019-12-12 13:22:09
问题 I am having problems getting one of my Angular routes to work in my application. Basically I have an MVC application that also uses a couple of SPAs. The MVC routing is as follows; namespace IMR { public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); // Angular reporting routes... routes.MapRoute( name: "Reporting", url: "Report/{*.}", defaults: new { controller = "Report", action = "RptIndex", id =

Angular router link active nested menu

五迷三道 提交于 2019-12-12 11:50:40
问题 I'm trying to make a nested menu with angular routes. What I need is to apply class to a nested route if it's active and apply class to a parent component if its child is active. How do I achieve this? For now I'm doing recursive menu building for ease of use when I need multilevel nesting. component.html <a (click)="toggleActive()" [class.active]="isActive" [routerLink]="menuItem.link" *ngIf="menuItem.link; else noLink"> <i *ngIf="menuItem.faClass" class="fa fa-{{menuItem.faClass}}"></i> {

JMSi18nRoutingBundle language selector

你说的曾经没有我的故事 提交于 2019-12-12 10:54:29
问题 I have implemented the following language switcher: <ul id="language-selector"> {% if path(app.request.attributes.get('_route')) == '/' %} <li><a href="{{ path("homepage", {"_locale": "es"}) }}">ES</a></li> <li><a href="{{ path("homepage", {"_locale": "en"}) }}">EN</a></li> <li><a href="{{ path("homepage", {"_locale": "it"}) }}">IT</a></li> {% else %} <li><a href="{{ path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')|merge({'_locale': 'es'})) }}">ES</a></li