url-routing

Client-side Javascript app - url routing with no hash tag

时间秒杀一切 提交于 2019-11-26 15:36:19
问题 I'm working on a new client-side only app with the latest version of Ember.js. There is a single PHP page which builds the scripts, css, template files, etc. and delivers it all into index.php. I'm using an htaccess directive so that all requests are rewritten to /index.php. The PHP is only there to conveniently package the Javascript, as far as I'm concerned. Currently, routes in the browser look like this and work just fine. /#/about /#/favorites /#/etc /#/posts/5/edit However, I would like

Difference between $state.transitionTo() and $state.go() in Angular ui-router

烂漫一生 提交于 2019-11-26 15:20:06
问题 In AngularJS, I see sometimes we use $state.transitionTo() and sometimes we use $state.go() . Can anyone tell me how they differ and when one should be used over the other? 回答1: Are you referring to the AngularUI Router? If so, the wiki specifies the differences: $state.go(to [, toParams] [, options]) Returns a Promise representing the state of the transition. Convenience method for transitioning to a new state. $state.go calls $state.transitionTo internally but automatically sets options to

ASP.NET MVC Routing Via Method Attributes [closed]

余生颓废 提交于 2019-11-26 14:49:40
In the StackOverflow Podcast #54 , Jeff mentions they register their URL routes in the StackOverflow codebase via an attribute above the method that handles the route. Sounds like a good concept (with the caveat that Phil Haack brought up regarding route priorities). Could someone provide some sample to make this happen? Also, any "best practices" for using this style of routing? UPDATE : This has been posted on codeplex . The complete source code as well as the pre-compiled assembly are there for download. I haven't had time to post the documentation on the site yet, so this SO post will have

Angular ui router - Redirection doesn't work at all

痴心易碎 提交于 2019-11-26 14:37:52
问题 I'm using ui.router for routing in my Angular app. There is a typical login scenario, where I'm redirecting a user to the login url if he's not logged in. Without the ui.router library, this worked fine using $routeChangeStart event combined with $location.path . Now, I'm using the $stateChangeStart event, combined with $state.go , and the nothing works! It also sends my browser into an infinite loop. I read from other sources that this is a known bug, and none of the suggested solutions work

AngularJS dynamic routing

拈花ヽ惹草 提交于 2019-11-26 14:03:47
I currently have an AngularJS application with routing built in. It works and everything is ok. My app.js file looks like this: angular.module('myapp', ['myapp.filters', 'myapp.services', 'myapp.directives']). config(['$routeProvider', function ($routeProvider) { $routeProvider.when('/', { templateUrl: '/pages/home.html', controller: HomeController }); $routeProvider.when('/about', { templateUrl: '/pages/about.html', controller: AboutController }); $routeProvider.when('/privacy', { templateUrl: '/pages/privacy.html', controller: AboutController }); $routeProvider.when('/terms', { templateUrl:

How to ignore route in asp.net forms url routing

回眸只為那壹抹淺笑 提交于 2019-11-26 13:17:47
问题 I am using the .NET 3.5 SP1 framework and I've implemented URL routing in my application. I was getting javascript errors: Error: ASP.NET Ajax client-side framework failed to load. Resource interpreted as script but transferred with MIME type text/html. ReferenceError: Can't find variable: Sys Which I believe is because my routing is picking up the microsoft axd files and not properly sending down the javascript. I did some research and found that I could use Routes.IgnoreRoute , which should

Multiple Spring @RequestMapping annotations

北战南征 提交于 2019-11-26 12:34:50
问题 Is it possible to use multiple @RequestMapping spring annotations in a method? Like: @RequestMapping(\"/\") @RequestMapping(\"\") @RequestMapping(\"/welcome\") public String welcomeHandler(){ return(\"welcome\"); } 回答1: @RequestMapping has a String[] value parameter, so you should be able to specify multiple values like this: @RequestMapping(value={"", "/", "welcome"}) 回答2: From my test (spring 3.0.5), @RequestMapping(value={"", "/"}) - only "/" works, "" does not. However I found out this

ASP.net MVC support for URL's with hyphens

主宰稳场 提交于 2019-11-26 12:07:06
问题 Is there an easy way to get the MvcRouteHandler to convert all hyphens in the action and controller sections of an incoming URL to underscores as hyphens are not supported in method or class names. This would be so that I could support such structures as sample.com/test-page/edit-details mapping to Action edit_details and Controller test_pagecontroller while continuing to use MapRoute method. I understand I can specify an action name attribute and support hyphens in controller names which out

Rails: redirect all unknown routes to root_url

99封情书 提交于 2019-11-26 12:02:28
问题 Whenever a user hits the wrong page, rails shows 404.html from the public folder. However, I\'d like just to redirect the browser to the root page, without showing anything. So I tried globbing, but came to no avail, it still shows the 404 page. Here\'s an extract from my routes file: # ... map.root :controller => \'home\', :action => \'home\' map.connect \'*\', :controller => \'home\', :action => \'home\' Any suggestions? Thanks, guys! 回答1: If your project is powered by rails 3, add simply

Using ASP.NET routing to serve static files

南笙酒味 提交于 2019-11-26 11:12:16
Can ASP.Net routing (not MVC) be used to serve static files? Say I want to route http://domain.tld/static/picture.jpg to http://domain.tld/a/b/c/picture.jpg and I want to do it dynamically in the sense that the rewritten URL is computed on the fly. I cannot set up a static route once and for all. Anyway, I can create a route like this: routes.Add( "StaticRoute", new Route("static/{file}", new FileRouteHandler()) ); In the FileRouteHandler.ProcessRequest method I can rewrite the path from /static/picture.jpg to /a/b/c/picture.jpg . I then want to create a handler for static files. ASP.NET uses