ember-router

Defining a multi segmented catch all route in ember.js

与世无争的帅哥 提交于 2019-12-21 09:23:07
问题 I am using Ember.js and I would like to create a catch all route to send the user back to the root of the application if they navigate to a URL that does not match a resource. (I am using the history API) I have implemented this like so: App.Router.map(function() { this.resource('things', function() { this.resource('thing', {path:':thing_id'}); }); this.route('catchAll', { path: ':*' }); this.route('catchAll', { path: ':*/:*' }); this.route('catchAll', { path: ':*/:*/:*' }); }); App.Router

“Dynamic segment” in Ember.js?

穿精又带淫゛_ 提交于 2019-12-21 02:52:25
问题 Throughout the Ember.js documentation, one finds the concept of dynamic segment mentioned at several places. What does it mean? 回答1: Updating with a proper sample: Demo | Source Edit due to questions in comments: In Ember, think of the Router mechanism as a State Machine: Each Route can be seen as a State. Sometimes tho, a state can have it's own little state machine within it. With that said: A resource is a state which you have possible child states. A PersonRoute can be defined as either

In latest Ember, how do you link to a route with just the id/name of a model, rather than providing all of its attributes in the linking page?

有些话、适合烂在心里 提交于 2019-12-20 09:56:00
问题 I ran into a problem when converting from Ember 1.0-pre2 to latest master (43354a98) and the new router, namely-- If I have a route which loads just the name and ID for a bunch of records, and tries to link each of those records to another route which should display the full model, when I arrive at the new route, the new model is never loaded, and name and ID are the only attributes that are available. Example code: App.Router.map(function() { this.route("index"); this.resource("birds"); this

can we view all the routes in emberjs aka something similar to what rake routes does in rails

淺唱寂寞╮ 提交于 2019-12-18 12:24:11
问题 As the routes file in emberjs is becoming large, I am finding it difficult to keep track of all the routes supported by emberjs app, rake routes in rails gives a list of routes in the rails app, is there a way to generate routes in similar fashion for emberjs? 回答1: Currently you can access all existing routes with App.Router.router.recognizer.names or just the names using Ember.keys(App.Router.router.recognizer.names) . It's obviously not as extensive as the Rails routes but it gives a quick

Idiomatic Emberjs for nested routes but non-nested templates

江枫思渺然 提交于 2019-12-18 02:16:06
问题 This is a follow-up from Understanding Ember routes. Master/detail views are great but I'm trying to have a a hierarchical URL route without nesting their templates. However, I still need access to the parent model for things like breadcrumb links and other references. So /users/1/posts should display a list of posts for user 1. And /users/1/posts/1 should display post 1 for user 1, but it shouldn't render inside the user template's {{outlet}} . Instead, it should completely replace the user

Is resource nesting the only way to enable multiple dynamic segments?

蓝咒 提交于 2019-12-17 10:52:22
问题 This seems to suggest that the answer is yes: From Ember Pre1 to Pre4: Multiple dynamic segments per route? Update: What is the allowed syntax for dynamic segments? ... but I just want to confirm. In my case, as a learning exercise, I'm building a calendar in Ember, with monthly displays. I need to be able to link from a given month to the previous month, and to the next month. So I'd like to be able to {{ linkTo calendar_month year month }} and this.transitionTo('calendarMonth', year, month)

Is resource nesting the only way to enable multiple dynamic segments?

百般思念 提交于 2019-12-17 10:52:21
问题 This seems to suggest that the answer is yes: From Ember Pre1 to Pre4: Multiple dynamic segments per route? Update: What is the allowed syntax for dynamic segments? ... but I just want to confirm. In my case, as a learning exercise, I'm building a calendar in Ember, with monthly displays. I need to be able to link from a given month to the previous month, and to the next month. So I'd like to be able to {{ linkTo calendar_month year month }} and this.transitionTo('calendarMonth', year, month)

Right way to do navigation with Ember

陌路散爱 提交于 2019-12-17 08:22:06
问题 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? 回答1: <Update date="2013-01-16"> The previous examples are no longer valid

Emberjs Routing: Page reloads on every link click

孤街醉人 提交于 2019-12-13 23:29:42
问题 I have an Ember js app, with pushstate enabled. Say I am on a page www.xyz.com/start and I have proper link on the page ( www.xyz.com/abc/def ) and I have defined route in ember for /abc/def . But every time I click on the link, the page is reloaded instead of directly being served by the Ember router. What is the correct way to do this? 回答1: You have to use the link-to helper instead of basic a href links. {{#link-to 'abc/def'}}go to def{{/link-to}} Where 'abc/def' is the route name. See :

Short delay when trying to run redirect with ember route with firebase authentication

老子叫甜甜 提交于 2019-12-13 04:43:24
问题 Alright, this is my first question on SO so I'll try to make it a good one sorry ahead of time. I've been using ember-cli to work on a product. I am using Firebase simple login for authentication and have created an initializer that adds an auth object to all my controllers and routes. This works, but... There seems to be a delay for the redirect checking. example I go to /secret and this should redirect me back to the /login route and it does but there is a slight delay where I can see the