ember-router

Can I use a pre-computed value as url parameter in emberjs

喜你入骨 提交于 2019-12-25 03:56:08
问题 I am just playing with angularjs and the ui-router module and I am not satisfied with it. I am missing a function/a process that allows me to execute logic before a state is activated. The logic is to calculate the first day of the week of the current logged in user. Thus before the weekly view of a calendar is activated I have to execute this date logic so the user gets an url like: /dateplanner/week/'firstdayOfWeek' Its not enough for me to show a /dateplanner/week url. 回答1: Yes. In

How can we reload a route Ember JS (versoin 1.0.0-rc.1)

China☆狼群 提交于 2019-12-25 02:07:20
问题 I have a condition where my route: application.com/#/sample/:id is redirected back to application.com/#/sample/:id For example, application.com/#/sample/1 gets an event which redirects to application.com/#/sample/2 This does not cause a reload. Has any one got this case fixed? Actually I am having a case application.com/#/parent/123/sample/1 causing redirect to application.com/#/parent/123/sample/2 Event is received by ParentRouter to transitionTo("parent.sample",{id:2}) . What I get in the

Emberjs 1.0.0-RC3: using NEEDS-API to access other controller content property

余生颓废 提交于 2019-12-25 01:55:54
问题 I want to render events and appointments on thesame page. But when I use the needs api from the AppointmentController to have access to EventsController , I can see that it returns appointments inside the 'events controller content property' when inspected. But when i try to use that returned content that contains 'appointments' to fetch out the appointments it fails. I am fetching events content in AppintmentsController with eventAppt = this.get('controllers.events').get('model'); which

following emberjs guide for #linkTo helper does not display individual post

主宰稳场 提交于 2019-12-24 20:40:42
问题 I have a jsfiddle with a route as shown below, which is exactly thesame as the one in emberjs guides and when I click on the #linkTo helper attached to {{post.title}} , it ought to show me the individual post but it does not and instead the console shows this errors: Uncaught Error: assertion failed: Cannot call get with 'id' on an undefined object. Also when I click the posts link on the home page, it displays all the titles but in the console, it also shows this error: Uncaught Error:

Multiple routers for an Ember app

六月ゝ 毕业季﹏ 提交于 2019-12-24 16:26:05
问题 Is it possible to have multiple router.js for an Ember app? By default one router.js will have import Ember from 'ember'; import config from '../../config/environment'; var Router = Ember.Router.extend({ location: config.locationType }); export default Router.map(function() { this.resource('sampleroute'); }); and other router.js will have import Ember from 'ember'; import config from '../../config/environment'; var Router = Ember.Router.extend({ location: config.locationType }); export

The route i came from, or previous route

▼魔方 西西 提交于 2019-12-22 09:47:00
问题 When i visit one route and then go to another, is where a way to know which route i came from? I tried document.referrer - this doesn't work. Googling hadn't brought any answers either.. I set up this fiddle for example and testing.. 回答1: There is no direct solution using the API. Meaning, this information is not part of the public API. However, you can cache this information yourself. App.set('lastRoutes', []); App.BaseRoute = Ember.Route.extend({ setupController: function() { this._super

The route i came from, or previous route

风格不统一 提交于 2019-12-22 09:46:26
问题 When i visit one route and then go to another, is where a way to know which route i came from? I tried document.referrer - this doesn't work. Googling hadn't brought any answers either.. I set up this fiddle for example and testing.. 回答1: There is no direct solution using the API. Meaning, this information is not part of the public API. However, you can cache this information yourself. App.set('lastRoutes', []); App.BaseRoute = Ember.Route.extend({ setupController: function() { this._super

Ember.js - Call parent model hook to load data for child

陌路散爱 提交于 2019-12-22 06:01:29
问题 I have a master/detail view in Ember. If i am calling the detail page directly, the model hook of the detail page needs the model(data) from the parent(master). The detail model hook is called - whats the proper way to get/call the model so the modelFor function in the detail hook works. Router: App.Router.map(function(){ this.resource('index', { path: '/' } ); this.resource('devices', { path: '/devices'}, function() { this.resource('device', { path: ':imei'}); }); }); Master Route: App

Ember.js - Call parent model hook to load data for child

筅森魡賤 提交于 2019-12-22 06:01:05
问题 I have a master/detail view in Ember. If i am calling the detail page directly, the model hook of the detail page needs the model(data) from the parent(master). The detail model hook is called - whats the proper way to get/call the model so the modelFor function in the detail hook works. Router: App.Router.map(function(){ this.resource('index', { path: '/' } ); this.resource('devices', { path: '/devices'}, function() { this.resource('device', { path: ':imei'}); }); }); Master Route: App

Ember deeply nested routes do not keep parent dynamic parameter

吃可爱长大的小学妹 提交于 2019-12-22 04:03:59
问题 I've got this ember application: Ember : 1.3.2 Ember Model : 0.0.11 Handlebars : 1.3.0 jQuery : 1.9.1 Using this resource map: App.Router.map(function () { this.resource('dimensions', function() { this.resource('dimension', { path: ':dimension_id'}, function () { this.resource('value', { path: 'values/:value_id' }); }); }); }); And this allows me to embed {{outlet}} in "dimensions" template that fills with "dimension" template, and embed {{outlet}} in "dimension" template that fills with