routing

AngularJS reinitialize controller

可紊 提交于 2019-12-05 09:42:08
I have got a controller named newGroupCtrl whose definition is like : .state('new_group', { url: '/new_group', templateUrl: 'templates/new_group.html', controller: 'newGroupCtrl' }) .controller('newGroupCtrl', function ($scope, $rootScope,$ionicHistory,$window) { $rootScope.roomId = $scope.getRoom(); $scope.getRoom = function () { var date = new Date; var minutes = date.getMinutes(); var hour = date.getHours(); return 'room_' + hour + '' + minutes; }; } I reach this contoller from previous page by : $window.location.href = ('#/new_group'); That's good until now. $rootScope.roomId variable is

Why does .htaccess redirect URL routing fine but break css/js/image links after two levels deep?

和自甴很熟 提交于 2019-12-05 09:16:12
问题 I have the following .htaccess file in a subdirectory of a site: RewriteEngine On RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?params=$1 [L,QSA] I have the following index.php file: <html> <head> <link href="css/main.css" rel="stylesheet"/> <script src="http://code.jquery.com/jquery-latest.js"></script> <script src="js/main.js"></script> </head> <body> <p>if css

Emberjs only redirect to default route if no subroute is specified

时间秒杀一切 提交于 2019-12-05 08:54:26
I'm trying to redirect /dashboard/ to /dashboard/reach/demographic if the url hits /dashboard/ . Problem is, I still get redirected to /dashboard/reach/demographic/ if I hit a subroute like **/dashboard/traffic. What is the Ember way of doing this? Here is my code: (function() { App.Router.map(function(match) { this.resource('dashboard', function() { this.resource('traffic', function() { this.route('visits'); this.route('pageviews'); return this.route('duration'); }); return this.resource('reach', function() { this.route('demographics'); this.route('over_time'); return this.route('devices'); }

URL Routing on ASP.net, need to get a parameter from the url

五迷三道 提交于 2019-12-05 08:52:22
I am developing group feature on asp.net application. I want to give users direct access to groups, so I want the url to be www.<domain>.com/<groupname> I implemented URL Routing for this case, but the problem that I want to pass the group name an to asp page as parameter, how can I do that? the actual path is "~/Public/ViewGroup?group=<groupname> , how to get this group name and add it to the virtual path? Thanks The quick answer is use: routes.MapPageRoute( "groupname", "{group}", "~/public/viewgroup" ); And then instead of (or as well as) using querystring to extract the value in ~/public

Rails 3 polymorphic_path - how to change the default route_key

前提是你 提交于 2019-12-05 08:35:48
I got a config with Cart and CartItem ( belongs_to :cart ) models. What I want to do is to call polymorphic_path([@cart, @cart_item]) so that it uses cart_item_path , instead of cart_cart_item_path . I know I can change the url generated by the route to /carts/:id/items/:id , but that's not what I'm interested in. Also, renaming CartItem to Item is not an option. I just want to use cart_item_path method throughout the app. Thanks in advance for any tip on that! Just to make my point clear: >> app.polymorphic_path([cart, cart_item]) NoMethodError: undefined method `cart_cart_item_path' for #

How to get the path of the request in symfony2

折月煮酒 提交于 2019-12-05 08:25:45
I know of the method \Symfony\Component\HttpFoundation\Request::getPathInfo() however in the docs it states that, that only returns the path of the request which is "relative" to the "executed script".How can I get the full path?and on a second note what does 'executed script' mean when all requests are going through the front controller? $request->getUri() return the absolute url => http://example.com/app.php/path $request->getRequestUri() return the absolute path => /app.php/path $request->getPathInfo() return the path corresponding to your controller's action => /path getPathInfo just

play framework route that matches all

一世执手 提交于 2019-12-05 08:21:27
I'm working on an angular app using play framework for my rest-services. Everything in the public folder is an angular app (stylesheets, javascripts, images and html). I want every request that is not for something in the stylesheets, javascripts, templates or images folder to be routed to the index.html page. This is so that angular routing can take over from there... As a side note i can mention that I am going to place every restservice under /services/ which links to my own java controllers. Is it possible in play framework 2.3.4 to define a route that catches all without having to use the

asp.net custom HttpHandler and URL routing

空扰寡人 提交于 2019-12-05 08:21:14
I want handle the requests to my application "http://example.com/whateverpath" by a custom HttpHandler but the return things depending of the value of "whateverpath". So users accessing "http://example.com/path1" will get different response than users accessing "http://example.com/path2", but both request must be handled in the same HttpHandler. The idea is find "whateverpath" in a database and depending of the result, return the response content. I hear about URL routing and I already have a custom Http handler working, but can I combine both technique to get what I need? I will appreciate

Subdomain constraint (Rails 3) makes local server (thin) SO SLOW

我是研究僧i 提交于 2019-12-05 08:09:57
I recently added a subdomain constraint to my Rails routes file constraints(:subdomain => 'new') do devise_for :customers do get "/customers/sign_up" => "registrations#new" post "/customers" => "registrations#create" put "/customers/:id" => "registrations#update" end match '/' => 'roxy#index' namespace :roxy, :path => '/' do resources :customers resources :surveys end end In order to test the subdomain routing constraint locally, I added this line to my hosts file. 127.0.0.1 new.localhost.local Now, I test my app in my browser at the URL new.localhost.local:3000. It takes about 10 - 15 seconds

How can I access polymorphic_path inside a model in Rails 4?

六眼飞鱼酱① 提交于 2019-12-05 08:06:47
Pretty simple, I want to use the polymorphic_path method inside a Rails 4 model. Yes I know it's poor separation of concerns. And I know about Rails.application.routes.url_helpers , but polymorphic_path isn't in there. Try including also PolymorphicRoutes : include ActionDispatch::Routing::PolymorphicRoutes include Rails.application.routes.url_helpers def link polymorphic_path(self) end 来源: https://stackoverflow.com/questions/27003252/how-can-i-access-polymorphic-path-inside-a-model-in-rails-4