ember.js

Handlebars template for Ember.js objects grouped by two

心已入冬 提交于 2019-12-24 17:17:30
问题 I have my data in the collection and I need to render them into the template. How can I achieve the result when the data is grouped by two? I need to sort them like this: ._______________________ | 1 | 3 | 5 |___|___|_______________ | 2 | 4 | and so on... |___|___|_______________ I have created vertical div element for each 1+2, 3+4, ... pair to style the items like this. How can I render the data in to such grid with handlebars? All I can do is this: {{#each App.myController}} ... render

trying to figure out how to set up this link in Ember

淺唱寂寞╮ 提交于 2019-12-24 17:14:21
问题 I'm looking at Ember to see whether it is suitable. One issue that came up is that we have many 'narrow' api calls - these calls return a list with the minimal data to create a list and then the user clicks on a link which goes to the detail view. Due to how link-to helper works, this will bypass the model method in the route. This question has the same issue: Transition from one route to another with a different model in Emberjs But I honestly don't understand the answer he provided.

Ember group binding

走远了吗. 提交于 2019-12-24 16:58:23
问题 I'm looking for a good way to bind grouped objects and render it to the grid. Here's a grid example: | League / Country | Canada | United States | Brazil | | 1 | John, Sam | | Tim | | 2 | Liam | | Robert | | 3 | | James, Peter, Tom | Den | And Player's model DS.Model.extend({ name: DS.attr(), country: DS.attr(), leagueId: DS.attr("number") }); And data received from backend is: [ { name: "John", country: "Canada", leagueId: 1 }, { name: "Sam", country: "Canada", leagueId: 1 }, { name: "Tim",

Handle scope variables with handlebars

折月煮酒 提交于 2019-12-24 16:53:36
问题 Using handlebars-1.1.2 and old emberjs 1.5.1. I just need to put one variable in label's "for": <label for='{{queue.id}}'> Instead <label for="6"> i get <label for="<script id=" metamorph-51-start'="" type="text/x-placeholder">6<script id="metamorph-51-end" type="text/x-placeholder"></script>'><script id="metamorph-52-start" type="text/x-placeholder"></script>Очередь через личный кабинет<script id="metamorph-52-end" type="text/x-placeholder"></script></label> If i simply use {{queue.id}}

Ember/emberfire run loop acceptance test

吃可爱长大的小学妹 提交于 2019-12-24 16:31:08
问题 So my acceptance test keeps on destroying itself before my promise finishes. I'm aware that I need to wrap my promise in Ember run loop but I just can't get it to work. Here's how my component looks: export default Ember.Component.extend({ store: Ember.inject.service(), didReceiveAttrs() { this.handleSearchQueryChange(); }, /** * Search based on the searchQuery */ handleSearchQueryChange() { this.get('store').query('animals', { orderBy: 'name', startAt: this.attrs.searchQuery }).then

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

Ember.js Hiding a view if no childView is created

冷暖自知 提交于 2019-12-24 16:10:04
问题 What I'm having here is basically look like this: filter |_ todo |_ todo filter |_ todo filter |_ todo Several filterView which have todoView nested inside. So first I'm creating instances of filterView and pass in all the params. <ul id="todo-list"> {{view 'filter' control=controller.beforeFilter title="Before" }} {{view 'filter' param='0' control=controller.todayFilter title="Today"}} {{view 'filter' param='1' control=controller.tomorrowFilter title="Tomorrow" }} </ul> This is how it look

Save record of model is not working in ember-data 1.0.0-beta.3?

a 夏天 提交于 2019-12-24 16:05:06
问题 What I have done - Model - App.Book = DS.Model.extend({ book_name: DS.attr('string'), edition: DS.attr('string') }); Router - App.Router.map(function() { this.resource('books', function() { this.route('new'); }); }); App.BooksNewRoute = Ember.Route.extend({ model: function() { return this.store.createRecord('book'); }, actions: { save: function() { this.modelFor('newBook').save(); } } }); Now Can anybody help me.. How to save data ? I am getting error like TypeError: this.modelFor(...) is

EmberJS - access properties of an object by arbitrary key in a template and have those properties bound using HTMLBars?

依然范特西╮ 提交于 2019-12-24 15:48:46
问题 With Handlebars I could do this: <script type="text/x-handlebars" data-template-name="index"> <table> {{#each model as |item index|}} <tr {{action 'update' index}}> {{#each col in columns}} <td>{{dd item col}}</td> {{/each}} </tr> {{/each}} </table> </script> App = Ember.Application.create(); App.IndexRoute = Ember.Route.extend({ model: function() { return [ { name: "Joe", description: "Good guy", age: 15 }, { name: "Moe", description: "Bad guy", age: 25 }, { name: "Dude", description: "Some

Ember App not playing sound in Chrome

送分小仙女□ 提交于 2019-12-24 15:21:39
问题 I have built an ember music app consuming favorite songs by SoundCloud using the api of this project. You can see the demo here From a couple of days i have noticed that only in Chrome any song i play, the sound and and the stream do not work, in the other browsers ( Safari and Firefox) it works well as usual. I thought at the beginning it was violating the content Security Policy directive in environment Ember Cli. See the question here but although i have solved it, the problem is still