ember-old-router

Why does Ember Router only allow navigating to leaf routes?

痞子三分冷 提交于 2019-12-03 07:45:13
Something I have noticed recently with Ember Router is it only allows navigating to leaf routes — routes without child routes. Now unless I'm doing things incorrectly then this seems like a bug/mistake in design. Let's take for example something like this: I have a collection of projects, each project has many collaborators, with this I want to build a UI with a 3 column layout (something like your standard desktop email client) where on the left I have a list of projects, when clicking on a project the middle column shows a list of collaborators, and clicking on a collaborator loads its

Ember.js routing: how do you set a default route to render immediately?

夙愿已清 提交于 2019-12-03 07:15:24
I'm sure this will become clear as I dig in deeper, but for now it's not obvious how to make this happen. I was following the info on this helpful SO article about routing but there is an important piece missing from the example, i.e. how do you get the 'home' view to render right away without having to click the 'home' link? I've started digging into the docs to try to make sense of this, but meanwhile it seems like a useful question to have answered for posterity. I've been playing with the working jsfiddle example from the above question here and comparing with this other example I found

Ember.js routing - conditionally prevent route/state change

狂风中的少年 提交于 2019-12-03 06:05:06
问题 I'm trying to figure out how to prevent or pause a route change. For my edit screens, if the user navigates away (back button or some other mechanism) when they have unsaved changes, I would like to prompt them to make sure they want to leave the page. Very similar to window.onbeforeunload , but via the router. The statechart in previous versions of Ember gave you a transition object that you could use. It seems that in ember-latest, this is no longer the case. So what's the best way to go

How *not* to destroy View when exiting a route in Ember.js

橙三吉。 提交于 2019-12-03 06:02:46
问题 Regarding the new Ember.js routing system (described here), if I understand correctly, views are destroyed when you exit a route. Is there any way to bypass destruction of views upon exiting a route, so that the state of the view is preserved when the user re-enters the route? Update: Looks like, views are not destroyed unless the outlet view is being replaced in the new route. For e.g., if you are in stateA with ViewA in some {{outlet master}} and you go to stateB with ViewB in {{outlet

EmberJS: How to transition to a router from a controller's action

久未见 提交于 2019-12-03 06:02:45
问题 I have an action: {{action create target="controller"}} which I have targeted to the bound controller (rather than the router) like this: App.AddBoardController = Ember.Controller.extend create: -> App.store.createRecord App.Board, {title: @get "boardName"} App.store.commit() //TODO: Redirect to route How do I redirect back to a route from the controller action? 回答1: In fact, this is not Ember idiomatic. From what I know, and what I have learnt from Tom Dale himself, here are some remarks

How *not* to destroy View when exiting a route in Ember.js

这一生的挚爱 提交于 2019-12-02 19:29:19
Regarding the new Ember.js routing system (described here ), if I understand correctly, views are destroyed when you exit a route. Is there any way to bypass destruction of views upon exiting a route, so that the state of the view is preserved when the user re-enters the route? Update: Looks like, views are not destroyed unless the outlet view is being replaced in the new route. For e.g., if you are in stateA with ViewA in some {{outlet master}} and you go to stateB with ViewB in {{outlet master}}, then ViewB will replace ViewA. A way around this is to define multiple outlets when you need to

Ember Router - How to handle 404 (Not Found) routes?

 ̄綄美尐妖づ 提交于 2019-12-02 19:26:19
I'm trying to figure out how to handle invalid routes within my application using Ember.Router . Currently if I enter an invalid route, e.g. myapp.com/#FooBarDoesntExist, it will redirect to the index route ('/'). I'd like it if I could define a notFound or 404 state that it would route to so I can inform the user what happend. As opposed to them getting dumped on the home page. tokarev Ember.Router in its current version does not provide means to handle unknown routes. Time to hack! Solution 1 - Quick and dirty The idea here is the following. We have the Ember.Router.route(path) method, which

Ember.js - How to properly bind a collection to a view using Ember.Router?

为君一笑 提交于 2019-11-30 14:19:01
问题 I was previously working with Ember.StateManager and now I'm doing some tests before I finally switch to Ember.Router , but I'm failing to understand how to properly bind my view data from the collection residing in my controller. I have a very simple testing structure with Ember.Router which is working fine navigation-wise , but when it comes to data binding it's not working as expected, and I confess I'm lost now. As for my data, I have a simple ASP.NET MVC4 Web API running a REST service

Ember.js - How to properly bind a collection to a view using Ember.Router?

…衆ロ難τιáo~ 提交于 2019-11-30 10:11:31
I was previously working with Ember.StateManager and now I'm doing some tests before I finally switch to Ember.Router , but I'm failing to understand how to properly bind my view data from the collection residing in my controller. I have a very simple testing structure with Ember.Router which is working fine navigation-wise , but when it comes to data binding it's not working as expected, and I confess I'm lost now. As for my data, I have a simple ASP.NET MVC4 Web API running a REST service which is working fine (I have tested with Fiddler and it's all good). Storing in SQL with EF4.* and no

Ember.js - CRUD scenarios - Specifying View from within a Route

醉酒当歌 提交于 2019-11-30 09:35:43
I've asked a question previously in which I wanted to bind a collection residing in the controller to the list scenario view , however, I've added details and edit templates and views to my structure producing a couple of extra sub-routes: root.contacts.details -> /contacts/:contact_id root.contacts.edit -> /contacts/:contact_id/edit In my details scenarios I first started calling the connectOutlets as follows [...] connectOutlets: function (router, contact) { router.get('contactController').set('contact', contact); router.get('applicationController').connectOutlet('contacts'); },[...] This