routing

Angular 4 - Routes - How to create a separate module for managing routes and use it in app.module.ts file

最后都变了- 提交于 2019-12-01 10:41:37
I am newbie in Angular, I want to implement the routes in separate component and import the same component in app.module.ts file. How do I import the routes component in app.module.ts file. I was trying like: app.routes.ts import { UsersComponent } from './users/users.component'; export class AppRoutes { getRoutes() { return [ { path: 'users', component: UsersComponent } ]; } } in app.modules.ts import { AppRoutes } from './app.routes'; @NgModule({ declarations: [ AppComponent, UsersComponent, ], imports: [ BrowserModule, HttpModule, HttpClientModule, RouterModule.forRoot(AppRoutes.getRoutes()

PHP routing with Codeigniter (Titles in URL for SEO)

天涯浪子 提交于 2019-12-01 10:39:44
I have some questions concering routing with Codeigniter. What I´m doing now is the following: $route['articles/(:num)'] = 'articles/view/$1'; // $1 will contain an ID This means that example.com/articles/123 will work perfectly and load an article with an ID of 123. But I also want to have the possiblilty to add the aticle´s title to the URL (for SEO). Example: example.com/articles/123/article-title What I want is pretty much the same thing as Stack Overflow: stackoverflow.com/questions/123/the-title How can I do that? I´m also wondering how Stack Overflow works. If I go to stackoverflow

Rails Routing Question: Mapping Slugs/Permalinks Directly under Root?

六月ゝ 毕业季﹏ 提交于 2019-12-01 10:08:32
问题 Morning Everyone!.. General Routing Quesiton Here... I'm currently working to achieve a route similar to this for users in my application. http://www.example.com/ username This then maps to the usersControllers#show, hence I have the following in my routes file. map.connect '/:permalink', :controllers => "users", :action => "show" I've then got the show action to find the user by the permalink in the param. So its works but.... The problem I'm running into is that all other UNDEFINED routes

How should I implement localization with ASP.NET MVC routes?

浪尽此生 提交于 2019-12-01 09:14:59
I'm trying to plan for future (months away) localization of a new ASP.NET MVC site. Trying to decide what makes most sense to do, as far as constructing the URLs and routing. For instance should I start off immediately with this : http://www.example.com/en/Products/1001 http://www.example.com/es/Products/1001 or just http://www.example.com/Products/1001 and then add other languages later http://www.example.com/en/Products/1001 Thats my basic main issue right now, trying to get the routing correct. I want my URLs to be indexable by a search engine correctly. I'm not even sure if I want language

Symfony2 internal route in Twig render function

这一生的挚爱 提交于 2019-12-01 08:08:24
问题 My layout.html.twig : {{ render(controller('AcmeDemoBundle:Page:mainmenu')) }} The Page controller retrieves all pages from the Doctrine and renders mainmenu.html.twig with a set of pages. My mainmenu.html.twig : {% if menu_pages is defined %} {% for page in menu_pages %} <li class="{% if app.request.attributes.get('_internal') == '_page_show' and app.request.get('id') == page.id %}active{% endif %}"><a href="{{ path('_page_show', {id: page.id}) }}">{{ page.title|e }}</a></li> {% endfor %} {%

ASP.NET MVC 2 RC2 Routing - How to clear low-level values when using ActionLink to refer to a higher level?

陌路散爱 提交于 2019-12-01 08:02:18
问题 [NOTE: I'm using ASP.NET MVC2 RC2.] I have URLs like this: /customers/123/orders/456/items/index /customers/123/orders/456/items/789/edit My routing table lists the most-specific routes first, so I've got: // customers/123/orders/456/items/789/edit routes.MapRoute( "item", // Route name "customers/{customerId}/orders/{orderId}/items/{itemId}/{action}", // URL with parameters new { controller = "Items", action = "Details" }, // Parameter defaults new { customerId = @"\d+", orderId = @"\d+",

vue-router creates always a new Component instance

余生长醉 提交于 2019-12-01 08:01:11
I found an issue in vue-router which triggers me a lot. Always when I switch between my routes, a new instance of the component is created. Further the old instances are not deleted and are running in background! I would expect that when I open a route, the old components will be destroyed or stop running. Is there a workaround to fix that issue? Here is a fiddle: https://jsfiddle.net/4xfa2f19/5885/ let foo = { template: '<div>Foo</div>', mounted() { console.log('Mount Foo with uid: ' + this._uid); setInterval(() => {console.log('Instance ' + this._uid + ' of Foo is running')}, 500); } }; let

How to map Home/Action/id to just action/id?

自作多情 提交于 2019-12-01 07:38:46
At the moment I have just this route defined routes.MapRoute( "Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = "" } ); I want to map the /Home/Action1/id to just /Action1/id anybody knows how ? You may have to be careful with a route like you're asking for because it may catch more than is intended. One workaround is to restrict that route by using constraints if possible. E.g. Check that id is numeric... routes.MapRoute("ActionRoute", "{action}/{id}", new { controller = "Home", action = "Index", id="1" }, new { id = @"\d{1,6}" } ); That way you can

Angular 4 - Routes - How to create a separate module for managing routes and use it in app.module.ts file

别等时光非礼了梦想. 提交于 2019-12-01 07:28:03
问题 I am newbie in Angular, I want to implement the routes in separate component and import the same component in app.module.ts file. How do I import the routes component in app.module.ts file. I was trying like: app.routes.ts import { UsersComponent } from './users/users.component'; export class AppRoutes { getRoutes() { return [ { path: 'users', component: UsersComponent } ]; } } in app.modules.ts import { AppRoutes } from './app.routes'; @NgModule({ declarations: [ AppComponent, UsersComponent

How should I implement localization with ASP.NET MVC routes?

安稳与你 提交于 2019-12-01 06:58:42
问题 I'm trying to plan for future (months away) localization of a new ASP.NET MVC site. Trying to decide what makes most sense to do, as far as constructing the URLs and routing. For instance should I start off immediately with this : http://www.example.com/en/Products/1001 http://www.example.com/es/Products/1001 or just http://www.example.com/Products/1001 and then add other languages later http://www.example.com/en/Products/1001 Thats my basic main issue right now, trying to get the routing