ember-old-router

Ember.js - where should interface state be stored?

不羁岁月 提交于 2019-11-30 07:34:17
Is there an official story for where interface state (as opposed to persisted model state) should live in an Ember.js app? In the "Responding to User-initiated Events" part of the Router docs , there's an example of delegating click events to a photo's "showPhoto" method, but having a model "show" itself seems like an undesirable mixing of concerns. I understand that in many cases state should be stored in the router so that the interface state is represented in the URL and is restored if you refresh the page or send the url to someone. But what about non-hierarchical state, such as the list

Ember.js Router Action to Controller

只谈情不闲聊 提交于 2019-11-30 07:33:07
When I use the Ember Router, how can I define actions in the template who are connected to the controller? An Example is here: http://jsfiddle.net/KvJ38/3/ Unter My Profile are two actions: One is defined on the State, and is working Two is defined on the Controller. How can i make this working or should I use another approach? App.Router = Em.Router.extend({ enableLogging: true, location: 'hash', root: Em.State.extend({ // EVENTS goHome: Ember.State.transitionTo('home'), viewProfile: Ember.State.transitionTo('profile'), // STATES home: Em.State.extend({ route: '/', connectOutlets: function

Emberjs 1.0-pre router can't find state for path and says router is undefined

一个人想着一个人 提交于 2019-11-29 12:46:01
This Emberjs router refuses to work with jsfiddle Jquery onDomReady and returns the error ; Uncaught Error: assertion failed: Could not find state for path: "root" . However, when i change the jsfiddle jquery settings to onLoad , the page loads but the router still seems unrecognized and any attempt to do a manually transition of the router fails with the message error: Cannot call method 'transitionTo' of undefined . But if i click one of the action helpers in the view that points or links to a route, it throws the error. Any suggestions on how to resolve this will be greatly appreciated. App

Ember.js - where should interface state be stored?

南笙酒味 提交于 2019-11-29 09:35:30
问题 Is there an official story for where interface state (as opposed to persisted model state) should live in an Ember.js app? In the "Responding to User-initiated Events" part of the Router docs, there's an example of delegating click events to a photo's "showPhoto" method, but having a model "show" itself seems like an undesirable mixing of concerns. I understand that in many cases state should be stored in the router so that the interface state is represented in the URL and is restored if you

Ember.js routing, outlets and animation

核能气质少年 提交于 2019-11-28 16:32:24
问题 It seems like if you want to animate a transition between states using the new Ember.js router and outlets, you're out of luck, since the previous content of an outlet will be destroyed before you have a chance to animate it. In cases where you can completely animate one view out before transitioning to the new state, there's no problem. It's only the case where both old and new views need to be visible that's problematic. It looks like some of the functionality needed to animate both the

Emberjs 1.0-pre router can't find state for path and says router is undefined

谁都会走 提交于 2019-11-28 06:19:28
问题 This Emberjs router refuses to work with jsfiddle Jquery onDomReady and returns the error ; Uncaught Error: assertion failed: Could not find state for path: "root" . However, when i change the jsfiddle jquery settings to onLoad , the page loads but the router still seems unrecognized and any attempt to do a manually transition of the router fails with the message error: Cannot call method 'transitionTo' of undefined . But if i click one of the action helpers in the view that points or links

Ember-Data: How do “mappings” work

一个人想着一个人 提交于 2019-11-28 06:03:18
I'm currently trying to put something together with ember + emberdata + router + asp.net web api. Most of it seem to work, however I stuck in an error message I get when ember-data tries to findAll through the adapter for my models. In my backend I have a model like this (C#): public class Genre { [Key] public int Id { get; set; } [Required] [StringLength(50, MinimumLength=3)] public string Name { get; set; } } Which in my app I represent it like this using ember-data: App.Genre = DS.Model.extend({ id: DS.attr("number"), name: DS.attr("string") }).reopenClass({ url: 'api/genre' }); I have also

Emberjs: Conditional redirect in router

这一生的挚爱 提交于 2019-11-27 23:49:57
Is there a way to have a conditional redirect in the Ember.js Router, without breaking internal consistency of the router? What you could do (as of today), is something like that: root: Ember.Route.extend({ index: Ember.Route.extend({ enter: function(router) { var logged = /* get from appropriated source... */; Ember.run.next(function() { if (logged) { router.transitionTo('loggedIn'); } else { router.transitionTo('loggedOut'); } }); } }), loggedIn: Ember.Route.extend({ // ... }), loggedOut: Ember.Route.extend({ // ... }) }) Do not miss the Ember.run.next as while you are in enter , the state

Right way to do navigation with Ember

折月煮酒 提交于 2019-11-27 06:34:19
What's the "right way" (or at least the options, if there is no single "Ember way" of doing this) for a navigation sidebar? Should I be looking at ContainerViews somehow, or should I just use the new outlet feature and stick the navigation inside my application view? In addition, what's the "right way" to set an .active class on an li depending on the URL (I'm using routing)? Is there some kind of a helper for this? MilkyWayJoe <Update date="2013-01-16"> The previous examples are no longer valid since the recent changes in the Router API, so I'm not going to fix those. All applications using

Emberjs develop a component in isolation with its own routing/states, which can be integrated to main app

社会主义新天地 提交于 2019-11-27 03:40:39
问题 I need to develop a component in ember. The component logic is somewhat isolated from main application and can be created as a seperate isolated application, with states and routes within the component. Presently I have root controller of component as 'ApplicationController' to enable routing, the name 'applicationController' looks like hard coded. Now I have the main application with its 'ApplicationController' + related routing, and my component with its 'ApplicationController' + related