routing

Angular: Unit Testing Routing : Expected '' to be '/route'

亡梦爱人 提交于 2019-12-05 12:13:04
Am working on unit testing for my routing under my Angular app , My routes are delacred in a specific module which is imported under the app.module.ts , here is my routing module: app-routing.module.ts import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { LoginComponent } from './login/login.component'; import { WelcomeComponent } from './welcome/welcome.component'; import { CustomersListComponent } from './customer/customers-list/customers-list.component'; import { CustomerDetailComponent } from './customer/customer-detail/customer-detail

Creating yii2 dynamic pages with url: www.example.com/pageName

雨燕双飞 提交于 2019-12-05 12:11:13
In my system, users need to have their profile pages. It is requested from me that these pages will be displayed in url like this: www.example.com/John-Doe www.example.com/Mary-Smith How to achieve these URLs in yii2 ? These John-Doe and Mary-Smith can be user usernames or profile names. For example I have field in user table called "name" and it will hold names "John Doe", "Mary Smith". Pay attention that I need SEO friendly URLs with "-" instead of blank spaces. URLs like this: www.example.com/profile/view?id=1 are not an option. www.example.com/John-Doe www.example.com/Mary-Smith I think

Weird routing error in Rails 3.0

五迷三道 提交于 2019-12-05 11:51:31
I've been converting my Rails 2.3.9 application to Rails 3.0 and everything has been going well. I've created a lot of routes with the new system so I feel like I know how to do this. However, I recently got a routing error I can't solve. I have a users resource defined like this: resources :users do member do get 'activate' get 'edit_password' post 'update_password' end collection do get 'forgot_password' post 'send_reset_instructions' end end The failing route is update_password. If I change it to a get method it works. But not when used as a post, with data coming from a form in "edit

How to specify a specific NIC to be used in an application written in c++ (boost asio)

倾然丶 夕夏残阳落幕 提交于 2019-12-05 11:02:56
I have a machine connected to multiple independent networks, each on a different NIC (Network Interface Card). The machine runs Windows 7. I run an application on the machine which needs to connect to a specific IP through a specific NIC, using TCP. The application uses c++11 and boost asio (1.53.0) for networking, and the source can be changed. What are the different reasonable ways to solve this problem (specify endpoint IP and NIC) in a Windows environment? The current solution assigns the respective (blocks of) IPs to the right NIC in the the routing table - by using the command line

url structure and form posts with Flask

送分小仙女□ 提交于 2019-12-05 10:44:58
In Flask you write the route above the method declaration like so: @app.route('/search/<location>/') def search(): return render_template('search.html') However in HTML as form will post to the url in this fashion www.myapp.com/search?location=paris the latter seems to return a 404 from the application where www.myapp.com/search/london will return as expected. I'm sure that there is a simple piece of the puzzle that i'm not getting, but surely the routing engine will consider the query string parameters for meeting the rules requirements. If not what is the optimal solution for this scenario

How to implement sub menu of the current route's children with vue.js and vue router

谁说我不能喝 提交于 2019-12-05 10:32:37
I'm trying to have the navigation on my Vue app to have a main menu up top populated by all the root level routes, and a side menu if the route has any children. Like so: The current Design I have has the main navigation with routing links on the top with the router-view below. I have been able to get the side menu working so it it only shows up when I choose Travellers and updates the components/content correctly. However I'm having trouble routing things correctly, when I click on one of the links in the sub menu it does not append to the current path. So when I click on View when I'm in

Symfony2 - How to add a global parameter to routing for every request or generated URL similar to _locale?

旧巷老猫 提交于 2019-12-05 10:27:53
I try add global parameter Parameter for all routes, and parameter setup in kernel Request Listener. routing mea_crm: resource: @Crm4Bundle/Resources/config/routing.yml prefix: /{_applicationid} defaults: { _applicationid: 0 } requirements: _applicationid: |0|1|2|3|4|5|6 in Listener - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest } I try setup this parameter $request->attributes->add(array( '_applicationid'=>$appCurrentId )); $request->query->add( array( '_applicationid'=>$appCurrentId ) ); $request->query->set('_applicationid',$appCurrentId); and still have in

Rails 3 routing based on context

强颜欢笑 提交于 2019-12-05 10:27:29
I am trying to implement a "context" system similar to the one used by GitHub. For example, a Post may be created belonging either to the User or one of the Companies the User belongs to depending on whether to User is in the "User" context or a context that refers to one of the Companies. As a part of this, I'd like to be able to do routing based on the user's current context. For example, if the User is in their own context, /dashboard should route to users/show , but if they are in the context for Company with ID 35, then /dashboard should route to companies/35/dashboard . I could route

WebAPI : 403 Forbidden after publish website

时间秒杀一切 提交于 2019-12-05 10:23:15
Alright, I'm having a tough time locating the problem since it works locally but after doing a publish the results are simply: Error Code: 403 Forbidden. The server denied the specified Uniform Resource Locator (URL). Contact the server administrator. (12202) The code: [RoutePrefix("api/v1/project")] public class ProjectController : BaseApiController { [HttpGet] public HttpResponseMessage GetProjects() { HttpResponseMessage resp = new HttpResponseMessage(HttpStatusCode.OK); if(User.Identity.IsAuthenticated) { var model = new ModelFactory().CreateProjects(); resp = Request.CreateResponse

How can you make sure a username won't conflict with an existing route?

こ雲淡風輕ζ 提交于 2019-12-05 09:53:07
So I'd like to have urls on my site like http://foobar.com/hadees that goes to someone's profile. However when registering usernames how do I make sure they don't pick something that will conflict with my existing routes? I'm guessing I need to get a list of the existing routes but I'm not sure how to do it. Thomas Guillory A short google search gives me that: http://henrik.nyh.se/2008/10/validating-slugs-against-existing-routes-in-rails In rails 3 the method has moved to Rails.application.routes.recognize_path So I summarize : class User < ActiveRecord::Base validates_format_of :name, :with =