ember-router

Ember, change current url and LinkTo targets without reloading data

為{幸葍}努か 提交于 2019-12-13 03:36:49
问题 How to change an url and the LinkTo components without reloading data? Figure an app where a user can change the name of his project. The current url contains the project name, so it must be updated. Nothing excepts the url and the links must be modified (no data reload) Consider this main route: this.route('routeName', { path: '/:project_name/:param2/:param3' }, function () { ...many sub routes }); The replaceURL method allow to change the url: this.router.location.replaceURL

How do I change query parameters in Ember?

浪尽此生 提交于 2019-12-12 20:05:51
问题 I'm writing an action handler in route:application : actions: { changeFoo(foo) { // I want to change the fooId queryParam to foo.get('id') } } The problem is that the only documented ways I can find to change the query params are transitionTo('some.route', someModel, { queryParams: { ... } } and the replaceWith version of the same. But I'm in route:application , so I don't know the current route's name. That means I don't know what the first argument to transitionTo would be. Is there another

Ember passing a model to transitionToRoute

我们两清 提交于 2019-12-12 13:33:46
问题 I'm using Ember-cli with ember 1.11 I'm trying to use the transitionToRoute method in a controller to transition to a route and feed it a dynamically generated object as the model. Here's my controller: import Ember from 'ember'; export default Ember.Controller.extend({ actions: { launch_scanner: function(){ console.log('launch_scanner'); var model = {name: "Edward", phone: "123", email: "email@test.com"}; //the final app will pull the model variable from a QR scanner this.transitionToRoute(

Ember cleanup on leaving route

孤街醉人 提交于 2019-12-12 10:56:42
问题 I want to make some cleanup when i leave route, like stopping timers. For that i need an event that triggers when leaving the route, and i need access to instance of controller inside of that event. There is an exit event, but it doesn't get any arguments, and this.get('controller') inside it doesn't work too - returns undefined . Is there a proper way for obtaining controller instance in the exit event, or, maybe, another event that i don't know of? I setup this fiddle with an example of

Ember, working with a model

落爺英雄遲暮 提交于 2019-12-12 10:18:29
问题 I'm confused about how to set up retrieve information from my (dynamic) model in Ember.js Here is my model (works so far): App.Router.map(function() { this.resource('calendar', { path: '/calendar/:currentMonth'}); }); App.CalendarRoute = Ember.Route.extend({ model: function (params) { var obj = { daysList: calendar.getDaysInMonth("2013", params.currentMonth), currentMonth: params.currentMonth }; return obj; } }); I just want to get back the 'currentMonth' attribute: App.CalendarController =

How to access controller from route in Ember?

◇◆丶佛笑我妖孽 提交于 2019-12-12 09:28:38
问题 Is there any foolproof way to access controller from a route? <a href="#" class="btn" {{action "someAction" user}}>add</a> App.ApplicationRoute = Ember.Route.extend events: someAction: (user) -> console.log 'give me name from currentUser controller' The someAction is very general and I think that ApplicationRoute is the best place for it. 回答1: I think the method controllerFor should be available in this event: App.ApplicationRoute = Ember.Route.extend events: someAction: (user) -> console.log

Ember JS transition to nested routes where all routes are dynamic segments from a view

自闭症网瘾萝莉.ら 提交于 2019-12-12 08:24:52
问题 We are writing an application using EmberJS. However we are still new with this framework and we're having a hard time resolving some of what may seem to be straight forward. The model is pretty simple, there are 3 models: Queue, Task, and Image. We are using dynamic URI segments for all routes and routes for these models are nested in the form: :queue_id/:task_id/:image_id. The routes are configured this way: App.Router.map(function() { this.resource('queue', {path: ':queue_id'}, function()

EmberJs: how to use connectOutlet

[亡魂溺海] 提交于 2019-12-11 15:05:21
问题 I've created a simple test in which I try to use connectOutlet. However, not much is rendered. Here is my test code: http://jsfiddle.net/jeanluca/53dpA/ Just to summarize the application. I think the problems is inside the following code App.Router.map(function(match) { match('/').to('index'); }); App.IndexRoute = Em.Route.extend({ connectOutlets: function(router) { router.get('applicationController').connectOutlet('sidebar', 'navigation'); router.get('applicationController').connectOutlet(

Passing parameters between routes in Ember 2.x

杀马特。学长 韩版系。学妹 提交于 2019-12-11 06:01:35
问题 While going from one route to another, I want to pass some data (especcially arrays). How is it possible? Why can't we use query-params with arrays? Is it a problem storing data in a specific service during transition? Note: I know there are some old questions those are nearly the same with this question. But their selected answers are no more applicable for Ember 2.x. Those questions are: 1, 2. 回答1: I´m not sure if queryparams won´t work with arrays as I only used it with single ids, but it

Emberjs 1.0, Computed property and template not refreshed when data changes

三世轮回 提交于 2019-12-11 05:47:55
问题 I have an emberjs app that integrates with datepicker. When I click a date on the datepicker, a computed property is supposed to compare the clicked date with the dates on *timeslot** to see if there is a match and I expect the template to refresh based on that, either listing the available timeSlots or saying there is not. Unfortunately, the template doesn't refresh or present new data. This is the jsfiddle , the important controllers/routes/templates are timeSlot , appointment , datePicker