Questions tagged [ember-router]

Ember.Router is a built-in routing mechanism within Ember.js which represents application state with a URL. It gives you helpful tools for managing application state in a way that scales with your application.

Ember.Router is a built-in routing mechanism within Ember.js which represents application state with a URL. It gives you helpful tools for managing application state in a way that scales with your application.

Getting Help

A guide for Ember.Router can be found at the official page, as well as gists added to GitHub by the developers. Besides asking questions on Stack Overflow, there is an IRC channel (#emberjs) on irc.freenode.net. The wiki on the GitHub pages provides some further links to useful ressources like talks, blog posts and frameworks.

407 questions
114
votes
1 answer

What is the difference between a route and resource in New Router API?

I am trying to understand the difference between a Route and a Resource. The way I understand Resource helps to set sub paths of a Route object to another Route Object. But its unclear when i think of default name mapping happening for paths as…
thecodejack
  • 12,689
  • 10
  • 44
  • 59
48
votes
2 answers

What is the complete list of expected JSON responses for DS.RESTAdapter?

I am attempting to write a custom express.js based server for an Ember.js app. I am getting along fairly well but I'm constantly getting stuck trying to guess what JSON responses Ember Data is expecting at a given moment. This brand new…
James Andres
  • 1,522
  • 14
  • 20
28
votes
2 answers

How to access controller from route in Ember?

Is there any foolproof way to access controller from a route? add App.ApplicationRoute = Ember.Route.extend events: someAction: (user) -> console.log 'give me name from…
wryrych
  • 1,765
  • 4
  • 20
  • 31
28
votes
2 answers

Right way to do navigation with Ember

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…
user1499207
  • 305
  • 1
  • 4
  • 7
26
votes
4 answers

How to pass API keys in environment variables to Ember CLI using process.env?

How do I pass environment variables from bashrc to Ember CLI. I imagine a situation where you need stripe api keys or pusher api-keys and you have them in your environment variables in bashrc. How do you pass the api-keys to Ember CLI. I tried…
brg
  • 3,915
  • 8
  • 37
  • 66
22
votes
3 answers

Ember.js sorting and filtering children of a hasMany relationship in parent route

Update #2 I found that when I refactored the filtering logic to take place in a compound computed property within the PostController instead of within individual routes, I was able to get it working. The solution was ultimately dependent upon a…
Bryan Langslet
  • 292
  • 2
  • 10
18
votes
2 answers

What's the proper way to access parameters from within Ember.Route. setupController?

Ember.Route.model has access to the params variable, but Ember.Route.setupController does not. This is troublesome for me, because my path has multiple dynamic segments, and I need to use all of them in my template. Specifically, my path looks like…
NudeCanalTroll
  • 2,266
  • 2
  • 19
  • 43
18
votes
2 answers

How can I get My previous route?

How can I get my previous router in my current controller. App.MyController = Em.ObjectController.extend({ next:function() { // This is my action helper in HBS this.transitionTo('nextPage'); }, back:function() { // This is my…
Bob
  • 451
  • 1
  • 5
  • 16
17
votes
1 answer

Idiomatic Emberjs for nested routes but non-nested templates

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…
Ike
  • 763
  • 1
  • 7
  • 17
17
votes
4 answers

Ember - Automatically redirect to firstObject

I'd like an Ember path /clinic/1 to automatically redirect to show the first doctor: /clinic/1/doctor/1. Each clinic has many doctors. Unfortunately if I use this code: var doctor =…
Chris Nolet
  • 8,714
  • 7
  • 67
  • 92
16
votes
2 answers

Can an Ember.js Route redirect to an external URL?

If I want to have a URL on an Ember.js website called example1.com that forwards to a URL on example2.com, how would I do that. Can I create a route of example1.com that will perform the forward to example2.com - maybe in the beforeModel hook?
Chris
  • 824
  • 1
  • 7
  • 26
15
votes
2 answers

Hashbang URLs using Ember.js

I am trying to set up my Router to use "hashbang" URLs (#!). I tried this, but obviously it doesn't work: App.Router.map(function() { this.route("index", { path: "!/" }); this.route("otherState", { path: "!/otherState" }); }); Is this…
twiz
  • 9,041
  • 8
  • 52
  • 84
15
votes
2 answers

How Can The Current Route Be Observed for Changes?

I want to update the tag for the page whenever the location (route) changes. I'm particularly interested in observing App.Router's current route changing - I then want to access the View associated with that route and update the <title> tag…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/ember.js" class="post-tag grid--cell" title="show questions tagged 'ember.js'" rel="tag">ember.js</a> <a href="../../questions/tagged/ember-router" class="post-tag grid--cell" title="show questions tagged 'ember-router'" rel="tag">ember-router</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Jan 19 '13 at 18:11">asked Jan 19 '13 at 18:11</time> <a href="../../users/605707/deefour" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/605707.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="deefour" /> </a> <div class="s-user-card--info"> <a href="../../users/605707/deefour" class="s-user-card--link">deefour</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">34,974</li> <li class="s-award-bling s-award-bling__gold" title="7 gold badges">7</li> <li class="s-award-bling s-award-bling__silver" title="97 silver badges">97</li> <li class="s-award-bling s-award-bling__bronze" title="90 bronze badges">90</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-14367517"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>15</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>1</strong> answer </div> </div> </div> <div class="summary"> <h3><a href="../../questions/14367517/in-latest-ember-how-do-you-link-to-a-route-with-just-the-id-name-of-a-model-ra" class="question-hyperlink">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?</a></h3> <div class="excerpt">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…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/ember.js" class="post-tag grid--cell" title="show questions tagged 'ember.js'" rel="tag">ember.js</a> <a href="../../questions/tagged/ember-router" class="post-tag grid--cell" title="show questions tagged 'ember-router'" rel="tag">ember-router</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Jan 16 '13 at 20:46">asked Jan 16 '13 at 20:46</time> <a href="../../users/386004/estoner" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/386004.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="estoner" /> </a> <div class="s-user-card--info"> <a href="../../users/386004/estoner" class="s-user-card--link">estoner</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">305</li> <li class="s-award-bling s-award-bling__silver" title="3 silver badges">3</li> <li class="s-award-bling s-award-bling__bronze" title="12 bronze badges">12</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-15131788"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>14</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status "> <strong>3</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/15131788/display-crumble-path-with-ember" class="question-hyperlink">Display crumble path with ember</a></h3> <div class="excerpt">I want to display a crumble path with Ember. How can I iterate through the current path? In my opinion there are two approaches: The ember-way EDIT: see my answer below I keep this question up-to-date with the current status of displaying…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/ember.js" class="post-tag grid--cell" title="show questions tagged 'ember.js'" rel="tag">ember.js</a> <a href="../../questions/tagged/breadcrumbs" class="post-tag grid--cell" title="show questions tagged 'breadcrumbs'" rel="tag">breadcrumbs</a> <a href="../../questions/tagged/ember-router" class="post-tag grid--cell" title="show questions tagged 'ember-router'" rel="tag">ember-router</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Feb 28 '13 at 09:23">asked Feb 28 '13 at 09:23</time> <a href="../../users/1474739/willem-de-wit" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/1474739.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Willem de Wit" /> </a> <div class="s-user-card--info"> <a href="../../users/1474739/willem-de-wit" class="s-user-card--link">Willem de Wit</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">8,604</li> <li class="s-award-bling s-award-bling__gold" title="9 gold badges">9</li> <li class="s-award-bling s-award-bling__silver" title="57 silver badges">57</li> <li class="s-award-bling s-award-bling__bronze" title="90 bronze badges">90</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="s-pagination pager fr"> <div class="s-pagination--item is-selected">1</div> <a class="s-pagination--item" href="../../questions/tagged/ember-router_page=2" rel="" title="Go to page 2">2</a> <a class="s-pagination--item" href="../../questions/tagged/ember-router_page=3" rel="" title="Go to page 3">3</a> <div class="s-pagination--item s-pagination--item__clear">…</div> <a class="s-pagination--item" href="../../questions/tagged/ember-router_page=27" rel="" title="Go to page 27">27</a> <a class="s-pagination--item" href="../../questions/tagged/ember-router_page=28" rel="" title="Go to page 28">28</a> <a class="s-pagination--item" href="../../questions/tagged/ember-router_page=2" rel="next" title="Go to page 2"> Next</a> </div> </div> </div> </div> </div> <script src="../../static/js/stack-icons.js"></script> <script src="../../static/js/fromnow.js"></script> </body> </html>