ember-router

assertion failed: An outlet (menu) was specified but this view will render at the root level

耗尽温柔 提交于 2020-01-24 14:15:31
问题 I have this weird assertion error when I was rendering an extra outlet on the root level of my application. This is the code I use: <div id="app"> <nav>{{outlet "menu"}}</nav> <div class="content">{{outlet}}</div> </div> I have a template called menu . This is my App.ApplicationRout app.ApplicationRoute = Ember.Route.extend({ renderTemplate: function() { this.render(); this.render("menu", { outlet: "menu" }); } }); But it is throwing an error: assertion failed: An outlet (menu) was specified

emberjs nested dynamic route segment returning null and unable to update child record

怎甘沉沦 提交于 2020-01-11 13:01:46
问题 I am trying to implement a comment-feature , to display a list of comments that belongs to a single post. Then click edit and edit any of the selected comments from from all the comments that belong to a single post. Updated jsfiddle . I am able to create a comment that belongs to the selected post as seen in the fiddle above. **However I am unable to updating an existing comment and the comment edit form won't even display any comment. It is always blank and doesn't bind to any existing

emberjs nested dynamic route segment returning null and unable to update child record

时间秒杀一切 提交于 2020-01-11 13:01:12
问题 I am trying to implement a comment-feature , to display a list of comments that belongs to a single post. Then click edit and edit any of the selected comments from from all the comments that belong to a single post. Updated jsfiddle . I am able to create a comment that belongs to the selected post as seen in the fiddle above. **However I am unable to updating an existing comment and the comment edit form won't even display any comment. It is always blank and doesn't bind to any existing

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

落花浮王杯 提交于 2020-01-09 12:50:14
问题 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 using Node.js process.env in both the brocfile.js and environment.js , but when I try to access it in the Ember JS controller, the property is null. In my environment.js file I added, APP: { apiKey: process.env.KEY } In My Ember JS controller I tried

Ember Restore State when Routing

北城以北 提交于 2020-01-05 10:30:14
问题 I have a application controller with a input bound to searchTerms and on click I am routing to search-results route. The code is from a book Rocknrollcall.Router.map(function() { // Add your routes here this.route('search-results', { path: 'search/:term' }); }); }); Rocknrollcall.ApplicationController = Em.ObjectController.extend({ searchTerms: '', actions: { submit: function() { this.transitionToRoute('search-results',this.get('searchTerms')); } } }); In the route I am returning some data I

how to create a right structure for nested routes in ember.js?

家住魔仙堡 提交于 2020-01-05 06:38:51
问题 I need to create an application with routes: /users - list of users /users/123 - user info /users/123/items - list of user items /users/123/items/456 - items info I wrote this code here $(function() { var App = window.App = Ember.Application.create({LOG_TRANSITIONS: true}); App.Router.map(function() { this.resource("users", {path: '/users'}, function() { this.resource("user", {path: '/:user_id'}, function() { this.resource("items", {path: '/items'}, function() { this.route("item", {path: '/

Ember-Router: How to add a route in run-time in Ember 1.0-rc2?

删除回忆录丶 提交于 2020-01-02 04:45:50
问题 In the new Ember.Router that shipts with Ember 1.0-rc2, is it possible add route in run-time? 回答1: There is not a supported method of doing this currently. The App.Router.map call is handled by lines 235-247 of this code: https://github.com/emberjs/ember.js/blob/master/packages/ember-routing/lib/system/router.js Ember.Router.reopenClass({ map: function(callback) { var router = this.router = new Router(); var dsl = Ember.RouterDSL.map(function() { this.resource('application', { path: "/" },

Detect route transitions in EmberJS 1.0.0-pre.4

大憨熊 提交于 2019-12-31 02:54:20
问题 I am trying to detect when a route transition occurs. I've located this code snippet inside the latest version of Ember ( v1.0.0-pre.4 ) that handles the transitions: didTransition: function(infos) { // Don't do any further action here if we redirected if (infos[infos.length-1].handler.transitioned) { return; } var appController = this.container.lookup('controller:application'), path = routePath(infos); set(appController, 'currentPath', path); this.notifyPropertyChange('url'); if (get(this,

How do I retrieve the path of a route?

强颜欢笑 提交于 2019-12-28 16:16:07
问题 Given the following Router setup: App.Router.map(function() { this.resource('posts', function() { this.route('new'); this.resource('post', { path: ':post_id' }, function() { this.route('edit'); }); }); }); Is it possible to obtain the path of a route? Fictitious example: App.Router.get('path', 'posts.new'); //=> "/posts/new" Or with a model like: App.Router.get('path', 'post.edit', model); //=> "/posts/1/edit" 回答1: Try this in your console/dev tools: App.Router.router.generate(['posts.new']);

How to get next route after the current route deactivate.?

让人想犯罪 __ 提交于 2019-12-25 07:49:45
问题 I have some code that uses route 'deactivate' method as follows. deactivate: function() { this._super(); //some code here } Is there a way to identify where is user trying to go(route of URL) after this route deactivates? 回答1: I would encourage you to use willTransition actions method hook for this purpose since that will be called before deactivate hook method. transition.targetName will provide the target route. actions: { willTransition(transition) { this._super(...arguments); console.log(