ember-router

Replace Ember.ArrayController.create() will not resolve belongTo relationships | ember upgrade 3.x

戏子无情 提交于 2019-12-11 05:37:26
问题 I'm in the process of upgrading and I'm facing issues because ArrayController is being deprecated. In my old Ember 1.13 route I'm using model/announcement.js export default DS.Model.extend( { id:DS.attr('string'), title: DS.attr( 'string' ), description: DS.attr( 'string' ), published: DS.attr( 'boolean' ), publishedAt: DS.attr( 'date' ), course: DS.belongsTo( 'course' ), author: DS.belongsTo( 'profile', { async: true } ), viewed: false, isNew: true, } serializer/announcement.js import DS

Understanding Ember routes

十年热恋 提交于 2019-12-11 03:18:22
问题 Assume I have routemap like this: App.Router.map -> @resource 'posts', -> @resource 'post', {path: '/:post_id'} So I have list of posts on /posts route and a single post on posts/2 . By default posts template will be rendered to {{outlet}} of a parent template ( application ) which is OK and post template to {{outlet}} of posts template which is not what I want. I want to replace list of posts with a single post. So I came with that solution to set desired template to render to it's {{outlet}

Ember.js: Get id from currently active route

落爺英雄遲暮 提交于 2019-12-10 19:55:47
问题 Probably the most straight-forward question I've asked recently. Given a route set up like so: Social.Router.map(function() { this.resource('accounts', function(){ this.resource('account', { path: ':account_id'}); }); }); And a URL like so: /accounts/12 How would I get the account_id if I wanted to get the currently active account record? The end goal is that I'm doing this: acct = App.Account.find(12) When I'd rather do this acct = App.Account.find(account_id) UPDATE 1 Here's the

Passing hidden parameters between routes

泄露秘密 提交于 2019-12-10 18:11:39
问题 I am much new to Ember.js, and trying to create an application where i need to surf through dates and privecy of records What i want to do is, i need to pass one variable value through ember routes without showing it on url appcication_routes.js.coffee App.Router.map -> @resource 'user', { path: '/user/:user_id' }, -> @resource 'user_feed', { path: '/feed' }, -> @route 'posts', { path: '/:date' } user_routes.js.coffee App.UserFeedIndexRoute = App.Route.extend activate: -> controller =

How to get all registered routers in ember (version 2.4.6) by es6

こ雲淡風輕ζ 提交于 2019-12-10 11:39:16
问题 I need a list of all registered routers in ember app. After searching on the Internet, I've found the link below: can we view all the routes in emberjs aka something similar to what rake routes does in rails Getting a list of routes in Ember.js But it does not work for me. this is App.js import Ember from 'ember'; import Resolver from './resolver'; import loadInitializers from 'ember-load-initializers'; import config from './config/environment'; let App; Ember.MODEL_FACTORY_INJECTIONS = true;

How do I disambiguate nested routes in ember.js?

若如初见. 提交于 2019-12-09 12:26:24
问题 I have two resources that both have the same sub-resource: App.Router.map(function() { this.resource('post', function() { this.resource('comments', function() { this.route('new'); }); }); this.resource('product', function() { this.resource('comments', function() { this.route('new'); }); }); }); The problem is that the ember router builds the names of the route objects out of just the current and parent routes, not out of the whole hierarchy. Thus, it tries to route both /posts/:id/comments

ember-data-1.0.0 activemodeladapter error include an `id` in a hash passed to `push`

只愿长相守 提交于 2019-12-08 19:46:23
问题 I am using ember-data and the activemodel adapter with rails and mongoid(mongodb) in the backend. Whenever I make a request to my rails app, emberjs displays the returned data but in chrome developer console it displays: Assertion failed: You must include an `id` in a hash passed to `push` the problem reproduced in a jsfiddle I have reproduced the problem in this jsfiddle . You can see a different version of thesame jsfiddle working when I use id instead of _id . Payload sent by the backend

How to pass Model route name item to linkTo in template in ember.js

你离开我真会死。 提交于 2019-12-08 00:59:38
问题 How do I pass a route name to a {{linkTo}} dynamically? For example, given this code: App.Router.map(function() { this.resource('anon', {path: '/main'}, function() { this.route('home', {path:'/home'}); this.route('about', { path: '/about' }); this.route('contact', { path: '/contact' }); }); }); App.NavController = Ember.ArrayController.extend({ selectedNav:'', setNav:function(value){ var nav = App.Nav.find(value); var items = nav.get('navItems'); this.set('content', items); } }); these

I18n in EmberJS (routing and in general)

依然范特西╮ 提交于 2019-12-07 11:07:00
问题 Does EmberJS support translated routes for internationalized apps? Or does it at least make it easy to extend it to support i18n routes? Anybody with experience with this? E.g. can the route string be somehow set dynamically from locale files? Also it would be cool when using Ember with Rails routing would not have to be specified twice... is that so? I'm new to Ember (currently evaluating js frameworks) but I assume in general with Rails one would simply specify very basic routes from within

Ember Routes and Rails Routes

烈酒焚心 提交于 2019-12-07 02:56:26
问题 This is the question that I've had ever since I started studying Ember to see how it might work with Rails. Rails has a routes.rb file with any number of existing routes. Ember has its own separate set of routes. How does the browser know to look for an Ember route when the route does not exist in rails? It would seem logical that rails would need to redirect the browser to Ember, but I have not seen that written up anywhere. In most cases where there's an existing rails app, the route in