nested-routes

Ember.js How to get controller in needs which is nested controllerName

烂漫一生 提交于 2019-11-30 17:27:37
I want to use this.get('controllers.pack.query'); to get App.PackQueryController in App.PackController , but failed. I think the problem is Ember use pack not pack.query as controllerName when it tries to get the controller. Although I can get the controller by this.controllerFor('pack.query') , but Ember says it is deprecated, please use needs instead My router map likes below and I've defined needs: ['pack.query'] in App.PackController App.Router.map(function () { this.resource('pack', function () { this.route('index', {path: '/:pack_id'}) this.route('query'); }); }); App.PackController =

Rails 4 [Best practices] Nested resources and shallow: true

折月煮酒 提交于 2019-11-30 01:32:59
The following post is based on Rails 4. I'm actually looking for a good best-practices about the multiple nested resources (more than 1), and the option shallow: true. First in my routes, there was this : resources :projects do resources :collections end The routes associated are : project_collections GET /projects/:project_id/collections(.:format) collections#index POST /projects/:project_id/collections(.:format) collections#create new_project_collection GET /projects/:project_id/collections/new(.:format) collections#new edit_project_collection GET /projects/:project_id/collections/:id/edit(.

Rails: Custom nested controller actions

心已入冬 提交于 2019-11-29 08:05:06
I want to setup a custom nested controller actions but I can't figure out the routing. I keep getting the following error No route matches [GET] "/assets" routes.rb resources :companies do resources :requests do match :accept end end index.html.rb <% @requests.each do |request| %> <ul class="users"> <li> <%= full_name(request.profile) %> <%= request.status %> <%= link_to "Accept", :controller => "requests", :action => "accept", :id => request.id %> </li> </ul> <% end %> There are a couple of problems: routing to the accept action and building a URL to a nested resource. Defining custom actions

Rails 4 [Best practices] Nested resources and shallow: true

本小妞迷上赌 提交于 2019-11-29 00:02:17
问题 The following post is based on Rails 4. I'm actually looking for a good best-practices about the multiple nested resources (more than 1), and the option shallow: true. First in my routes, there was this : resources :projects do resources :collections end The routes associated are : project_collections GET /projects/:project_id/collections(.:format) collections#index POST /projects/:project_id/collections(.:format) collections#create new_project_collection GET /projects/:project_id/collections

Angular2 router: how to correctly load children modules with their own routing rules

孤街浪徒 提交于 2019-11-28 06:46:26
here is my Angular2 app structure: Here is part of my code. The following is the main module of the Angular2 app, that imports its routing rules and a child module ( EdgeModule ) and uses some components related to some pages. app.module.ts @NgModule({ declarations: [ AppComponent, PageNotFoundComponent, LoginComponent ], imports: [ ... appRouting, EdgeModule ], providers: [ appRoutingProviders, LoginService ], bootstrap: [AppComponent] }) export class AppModule { } Here is the routing rules for the main module. It have paths to login page and page not found. app.routing.ts const appRoutes:

Rails: Custom nested controller actions

纵然是瞬间 提交于 2019-11-28 01:38:25
问题 I want to setup a custom nested controller actions but I can't figure out the routing. I keep getting the following error No route matches [GET] "/assets" routes.rb resources :companies do resources :requests do match :accept end end index.html.rb <% @requests.each do |request| %> <ul class="users"> <li> <%= full_name(request.profile) %> <%= request.status %> <%= link_to "Accept", :controller => "requests", :action => "accept", :id => request.id %> </li> </ul> <% end %> 回答1: There are a