ember.js

ember-data fixtureAdapter with embedded hasMany

可紊 提交于 2020-01-16 03:56:46
问题 I've been at this for a couple hours, fiddling with a number of different combinations to get this working. LO.List = DS.Model.extend({ name: DS.attr('string'), listItems: DS.hasMany('LO.ListItem', { embedded: true }) }); var lists = LO.store.findAll(LO.List), firstList = lists.objectAt(0), listItems = firstList.get('listItems'), firstListItemId = listItems.objectAt(0).get('id'); console.log(firstListItemId) // [object Object] http://jsfiddle.net/pjmorse/65eRS/ It seems that the 'embedded'

Does EmberJS Support Composed Components With Transitive Version Conflicts?

夙愿已清 提交于 2020-01-16 01:28:58
问题 I'm wondering whether I can build apps with EmberJS and browserify using components that may have child component dependencies with different versions? For example suppose component's A and B are used. Component A depends on component C:1.0.4 and component B depends on Component C:2.0.6. The reason I'm curious is that the Polymer registry does not support transitive dependencies that have version conflicts: https://github.com/Polymer/polymer/issues/326 Would a emberjs / browserify builds run

EMBER JS - Fetch associated model data from back-end only when required

别等时光非礼了梦想. 提交于 2020-01-15 12:15:09
问题 store.findRecord('school', school_id, { include: [ 'students', 'students.records' ].join(',') Using the above code fetching school, students, students' records data in inital load. In the initial load, I don't need students.records (only listing students initially) Need student records only when clicking some button (All Students Performance - to display a performance chart) Is there any way to fetch associated records separately and link with the existing model I have sperate api endpoint

Ember. Making modal view that has its own route

与世无争的帅哥 提交于 2020-01-15 09:06:27
问题 I want to make a modal view that can be accessible by its own route. The problem is — I want to show this view on top of other state/view/route of my app that have big data computed inside. I thought that i can do it with nested routes. If we run transition to child route, nothing will be recalculated, just child show - very good. But on practice, when I tried to add child routes for some my resources. I meet the problem described in this question. So, nested routes is not a solution for it.

Ember Handlebars not automatically putting model in scope

ⅰ亾dé卋堺 提交于 2020-01-15 07:04:25
问题 Typically, Ember automatically puts the route's model in scope when rendering a handlebars template: <h1>{{ title }}</h1> Renders: <h1>My Title</h1> For some reason, it's not doing that for me with a particular route. I'm just getting an empty <h1></h1> . However, if I manually put it into scope: <h1>{{ model.title }}</h1> Then it works as expected. What might be causing this behavior? My route is basic: MeetingsShowRoute = Ember.Route.extend model: (params) -> @store.find('meeting', params

Ember Handlebars not automatically putting model in scope

送分小仙女□ 提交于 2020-01-15 07:04:16
问题 Typically, Ember automatically puts the route's model in scope when rendering a handlebars template: <h1>{{ title }}</h1> Renders: <h1>My Title</h1> For some reason, it's not doing that for me with a particular route. I'm just getting an empty <h1></h1> . However, if I manually put it into scope: <h1>{{ model.title }}</h1> Then it works as expected. What might be causing this behavior? My route is basic: MeetingsShowRoute = Ember.Route.extend model: (params) -> @store.find('meeting', params

Ember.js sometimes not showing errors

不问归期 提交于 2020-01-15 05:52:50
问题 Sometimes the ember app crashes, normally when I do something at an earlier stage, but I haven't really seen a pattern - and no error is logged to the console. I can see the error if I set a break point to TRY_CATCH_ERROR.error = e; somewhere in the guts of the rendered app - but there has to be a simpler way I guess. 回答1: All errors: Ember.onerror = function(error) { console.log(error) } Implement an Ember.onerror hook to log all errors in production For Promises: Ember.RSVP.on('error',

Why is Firebase data not displaying properly in my Ember CLI generated output?

耗尽温柔 提交于 2020-01-15 04:49:51
问题 I've successfully setup Ember CLI and Firebase and I'm attempting to bring some basic data into my templates. My 'title' and 'subtitle' data are apparent in the Ember Inspector, as well as my Firebase project dashboard. However, {{foo.title}} and {{foo.subtitle}} are coming back empty and undefined in the browser. Why is that? Here's my code: application.js (adapter) import DS from 'ember-data'; export default DS.FirebaseAdapter.extend({ firebase: new window.Firebase('https://<firebase

Filter with query parameter based on related model

心已入冬 提交于 2020-01-15 04:49:28
问题 I am trying to filter a collection based on a related model, I have already tried several ways, but can't get it working: App.BetroundStatsController = Ember.ArrayController.extend({ needs: "betround", queryParams: ['query_game'], sortProperties: ['user.nickName'], query_game: null, computeFilter: Ember.computed.filterBy('model','game', this.get('query_game')), filtered: function(){ return this.get('model').filterProperty('game', this.get('query_game')); }.property('model.@each.game','query

How can I programatically select a drop down option using Ember?

跟風遠走 提交于 2020-01-15 04:32:05
问题 This is my sample drop down <select name="newType" class="parts-select full-width-combo" onchange={{action "loadFilter" value="target.value" }}> <option value="" selected hidden >Select </option> {{#each model as |item|}} <option value="{{item.id}}">{{item.description}}</option> {{/each}} </select> from the relevant template action I wanted to set this selected item dynamically. As an example it default selected by "Select" and then based on some button click on that page and need to set my