url-routing

Angular 4 Routing not working on live web-app

こ雲淡風輕ζ 提交于 2019-11-29 02:25:44
My Angular 4 web-app routing works fine in my dev environment, and the menu redirects work fine on the live version. However, the dev version redirects to different pages by typing in the address field of the browser, but the live version doesn't. Is this an Angular problem? Or do I need to manage my redirects with my ISP? My app.router.ts code is as follows: import { ModuleWithProviders } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { HomeComponent } from './home/home.component'; import { ArtComponent } from './art/art.component'; import {

ASP.NET MVC Default URL View

◇◆丶佛笑我妖孽 提交于 2019-11-29 01:32:12
I'm trying to set the Default URL of my MVC application to a view within an area of my application. The area is called " Common ", the controller " Home " and the view " Index ". I've tried setting the defaultUrl in the forms section of web.config to " ~/Common/Home/Index " with no success. I've also tried mapping a new route in global.asax, thus: routes.MapRoute( "Area", "{area}/{controller}/{action}/{id}", new { area = "Common", controller = "Home", action = "Index", id = "" } ); Again, to no avail. George Stocker The route you listed only works if they explicitly type out the URL: yoursite

How to trigger the Backbone.Router events in Backbone.js?

折月煮酒 提交于 2019-11-29 01:26:01
问题 Router in Backbone.js is responsible for routing client-side pages, and connecting them to actions and events based on urls. But how to trigger the url change? I mean if the only way to do this is to enclose the element associated with page routing in <a> tag. Because I have associated the mousedown and mouseup events with the element used for routing, if I put it in <a> tag, the mousedown and mouseup events will definitely become invalid as it will have conflict with the click event of <a>

Rails REST routing: dots in the resource item ID

夙愿已清 提交于 2019-11-29 01:24:09
I have following in my routes.rb: resources :users, :except => [:new, :create] do get 'friends', :as => :friends, :on => :member, :to => "users#friends" end and following in my user.rb: def to_param self.login end And when, for example, user with dots in login (for example 'any.thing') comes from facebook, rails gives routing error (no route found, I suppose that's because it recognises anything after dot as a format or because of route constraints). How can I come over this error? zetetic You could replace periods with another character: def to_param login.gsub(/\./,"-") # note: 'self' is not

Flask URL Route: Route Several URLs to the same function

风格不统一 提交于 2019-11-29 01:02:41
I am working with Flask 0.9. Now I want to route three urls to the same function: /item/<int:appitemid> /item/<int:appitemid>/ /item/<int:appitemid>/<anything can be here> The <anything can be here> part will never be used in the function. I have to copy the same function twice to achieve this goal: @app.route('/item/<int:appitemid>/') def show_item(appitemid): @app.route('/item/<int:appitemid>/<path:anythingcanbehere>') def show_item(appitemid, anythingcanbehere): Will there be a better solution? Why not just use a parameter that can potentially be empty, with a default value of None ? @app

How can I reload the current page in Ruby on Rails?

时光总嘲笑我的痴心妄想 提交于 2019-11-29 00:18:41
问题 I currently have a login popup in my header bar which is on every page in my website. I want to be able to reload the current page that the person is on after a successful login. How do I do this in the controller? def create #declaring and defining user variable stuff if user.save #reload current page <--how do I do this? end end Thanks 回答1: For my application, I use redirect_to :back and it does the trick. However, I doubt this might have an error in a non general use case(s) (user came

How to Implement URL Routing in PHP

一曲冷凌霜 提交于 2019-11-28 20:55:43
How to implement URL Routing in PHP. Vinko Vrsalovic If you use Apache you can do the URL routing via mod_rewrite. Small example: RewriteEngine On RewriteRule ^(dir1)/?(path2)? main.php?dir=$1&path=$2 That'll have any request like http://yoursite.com/dir1/path1 served by http://yoursite.com/main.php?dir=dir1&path=path2 More examples here . The other alternative have every request redirect to a single php file RewriteEngine On RewriteRule (.*) main.php?request=$1 and then to do it in code, where you can use a similar approach , by having a set of regular expressions that are matched by some

ASP.NET Routing with Web Forms

末鹿安然 提交于 2019-11-28 20:37:38
问题 I've read ASP.NET Routing… Goodbye URL rewriting? and Using Routing With WebForms which are great articles, but limited to simple, illustrative, "hello world"-complexity examples. Is anyone out there using ASP.NET routing with web forms in a non-trivial way? Any gotchas to be aware of? Performance issues? Further recommended reading I should look at before ploughing into an implementation of my own? EDIT Found these additional useful URLs: How to: Use Routing with Web Forms (MSDN) ASP.NET

Clearing URL hash

[亡魂溺海] 提交于 2019-11-28 19:12:00
Visit stackoverflow.com/#_=_ and window.location.hash evaluates to #_=_ . Fine. Now execute window.location.hash = '' to clear the hash, and the URL becomes stackoverflow.com/# . (Notice the trailing # .) Why is the # in window.location.hash inconsistently included or excluded? How can the # be removed from the URL without reloading the page? ( MDN says [the hash is] the part of the URL that follows the # symbol, including the # symbol. but that is not true for in the case of an empty hash.) To answer the second question (removing the # without a page refresh): history.pushState('', document

Get current url in Angular [duplicate]

你说的曾经没有我的故事 提交于 2019-11-28 19:02:54
This question already has an answer here: How to get current route 30 answers How can I get the current url in Angular 4? I've searched the web for it a lot, but am unable to find solution. app.module.ts import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { RouterModule, Router } from '@angular/Router'; import { AppComponent } from './app.component'; import { TestComponent } from './test/test.component'; import { OtherComponent } from './other/other.component'; import { UnitComponent } from './unit/unit.component'; @NgModule ({