ember.js

DEPRECATION: The default behavior of shouldReloadAll will change in Ember Data 2.0 to always return false when there is at least one

こ雲淡風輕ζ 提交于 2019-12-22 03:35:14
问题 At the moment of this question i'm running the latest Ember and Ember Data versions. I'm working with the DS.RESTAdapter calling for a /places this way: this.store.findAll('place'); The model only have a name attribute name: DS.attr('string') The JSON is the following: { places: [ { id: 1, name: "San Francisco" }, { id: 2, name: "Havana" } ] } I made the template and with the corresponding each and everything shows up and works so far but i get a deprecation warnings that tells the following:

html5 canvas and emberjs view

南楼画角 提交于 2019-12-22 01:29:50
问题 I'd like to add some drawing functionality in my ember based application. I plan to use the html5 canvas element. Basically, in my DOM I have <canvas id="my-canvas"> And I need to get my canvas context when the DOM is loaded with var c = document.getElementById('my-canvas') // ... do something with c If the canvas is represented with an Ember.View : App.Canvas = Em.View.extend({ tagName: 'canvas' }) What is the equivalent of document.getElementById ? 回答1: var view = App.Canvas.create().append

What's the difference between Ember.computed.alias and an Ember.binding?

余生颓废 提交于 2019-12-22 01:28:14
问题 In Ember, defining a property as a computed alias to another property (or another object's property) using Ember.computed.alias('otherProperty') seems to have basically the same result as defining it as a binding to that property using propertyNameBinding: 'otherProperty' . I've looked at the source and the documentation but I can't find any reason why one would be preferred over the other. Obviously templates use bindings, which is fine, but for properties in e.g. controllers, or for

EmberJS CRUD : deletedRecord keeps re-appearing after linkTo

家住魔仙堡 提交于 2019-12-22 01:21:25
问题 I have an issue with deleting records from an Ember.JS model. I have an overview of records in my handlebars template with a delete button for each row. When clicking the button I would like to remove that row from the table (and execute a DELETE on my REST API). My handlebars template contains the following table + delete button for every record. <table class="table table-hover"> <tr> <th>Latitude</th> <th>Longitude</th> <th>Accuracy</th> <th></th> </tr> {{#each model}} <tr> <td>{{latitude}}

Add 'Blink' feature in Ember Table

梦想的初衷 提交于 2019-12-22 01:18:43
问题 Here are issues if click on an updating column (to sort) blink feature does not work. if i try to filter, blink feature goes crazy. i am not sure if there are better ways to implement 'Blink'. Because i'm not sure the way i keep 'previousValue' and apply'clearStyles' method are correct. here is the link to previous discussion. How to apply 'Blink' feature in Ember Table? Kindly add suggestions. 来源: https://stackoverflow.com/questions/29071528/add-blink-feature-in-ember-table

How to render hasMany associations each with their own controller

﹥>﹥吖頭↗ 提交于 2019-12-22 00:25:31
问题 So my models are set up like this : App.Post = DS.Model.extend comments: DS.hasMany 'App.Comment' App.Comment = DS.Model.extend post: DS.belongsTo 'App.Post' I'm trying to create a view that has all posts and all comments display, but I need to decorate the comment objects. This is what I'd like to do but, to no avail : <ul> {{#each post in controller}} <li>{{post.title}}</li> <ol> {{#each comment in post.comments itemController="comment"}} <li>{{comment.body}}</li> {{/each}} </ol> {{/each}}

How to update just 1 record in Ember.js with Ember-data? Currently save() and commit() on 1 record actually updates all records of model

北城以北 提交于 2019-12-22 00:14:52
问题 Premise: My question is based on my research of Ember-data, which may or may not be correct. So please correct me if I have any misunderstanding. The examples are running with the latest ember as of July 2, 2013. To edit a record of my model, just 1 record, you need to call this.get('store').commit() or this.get('model').save() . However, downstream of either of these functions actually have to update all of the records of the model, even those left untouched. So this is quite inefficient,

Setting tagName on application template in ember js

假装没事ソ 提交于 2019-12-21 22:43:43
问题 Views are deprecated in ember js. I want to set the tagName for the application template to "empty" because I don't want my content wrapped in a div - it messes up my css. Previously I have don this by creating an views/application.js and setting tagName: '' but views are deprecated - how can I do this without views? 回答1: While I agree with the comments that this may not be something you want to do, you can use the ember-legacy-views addon until routable components are released. Tagless

Ember Data sideloaded properties being dropped on a model

ⅰ亾dé卋堺 提交于 2019-12-21 22:10:06
问题 I'm working with Ember RC3 Ember Data Revision 12 Handlebars RC3 I have Ember Data sideloading relationships on many of my models, so that I can template the sideloaded relationships like so: // Models App.Client = DS.Model.extend({ company: DS.attr('string'), accountNumber: DS.attr('string'), startDate: DS.attr('mysqlDate'), // Relationships campaigns: DS.hasMany('App.Campaign'), users: DS.hasMany('App.User'), phones: DS.hasMany('App.Phone'), addresses: DS.hasMany('App.Address') }); App.User

How can I dynamically set the `selected` attribute on an `<option>` tag?

有些话、适合烂在心里 提交于 2019-12-21 22:03:43
问题 The Ember guide on binding data attributes says that "If you use data binding with a Boolean value, it will add or remove the specified attribute." I'm trying to use this feature to dynamically set the selected attributes on <option> s. I'm finding that I can dynamically set the disabled attribute, but the selected attribute is always omitted, no whether the boolean is true or false. Given this handlebars template: <option disabled={{false}} selected={{false}}>One</option> <option disabled={