ember.js

Where are Ember Data's commitDetails' created/updated/deleted OrderedSets set?

你说的曾经没有我的故事 提交于 2019-12-24 11:44:25
问题 Ember Data's Adapter saves edited records in different groups of Ember.OrderedSets , namely: commitDetails.created, commitDetails.updated, and commitDetails.deleted. model.save() from model controller's createRecord() will be placed in the commitDetails.created group. model.save() from model controller's acceptChanges will placed be in the commitDetails.updated group. But I can't find in code where the placement association happens. I know that they are instantiated in Ember Transaction's

Ember js - Jquery hover effects stop working after element is hidden and redisplayed by ember {{/if}} conditional

杀马特。学长 韩版系。学妹 提交于 2019-12-24 11:40:22
问题 I want my jquery function to still work even after the element with the function is hidden and reshown using {{#if}} conditionals. Below is the function that ceases to work. App.RecordCategoriesView = Ember.View.extend({ didInsertElement: function() { $(".isPublic").on( 'mouseover', function(){ $(this).attr({src: "images/makePublic-blue.png"}); }); $(".isPublic").on( 'mouseout',function(){ $(this).attr({src: "images/makePublic-grey.png"}); }); $(".isPrivate").on( 'mouseover', function(){ $

Query params not updating in controller

北城余情 提交于 2019-12-24 11:37:43
问题 Using build v1.5.0-beta.4 My query params are showing up in the router in the params.queryParams object but do not seem to be updating their respective properties in the controller. Can't tell if this is a bug or behaving as expected. If this is behaving as expected, what flag do I need to set to get the desired behavior like in the older builds? Could someone take a look at this jsbin http://jsbin.com/tojamara/64/edit and see if this is a bug or not? If I change the build to the ones used in

Using Ember component's methods inside template

时光总嘲笑我的痴心妄想 提交于 2019-12-24 11:37:31
问题 I've just started learning Ember and one thing I'm confused that if I can access component's method inside the template. For example, I have a note-list component that render list of note-line as follow: <ul class="list"> {{#each notes as |note|}} {{note-line note=note index=@index selected=(isSelected note)}} {{/each}} </ul> The note-list component is defined as: Ember.Component.extend({ tagName: '', isSelected(note) { return note.id === this.get('selectedNote').id } }) But I'm getting error

Ember.js - afterRender fires before CSS is finished

爷,独闯天下 提交于 2019-12-24 11:26:38
问题 I'd like to show a loading symbol while my validation is processing. My .hbs file looks like this <div {{bind-attr class='isProcessing:spinner'}}></div> I tried to wrap my validations into the afterRender run loop, but apparently afterRender doesn't mean after-CSS. My validations are executed before the css class of the div changes (It doesn't change at all). App.PostController = Em.Controller.extend({ isProcessing: false, actions: { savePost: function() { this.set('isProcessing', true);

Rendering a template and invoking model hook in Ember.js

倾然丶 夕夏残阳落幕 提交于 2019-12-24 10:57:59
问题 I am using JSON requests to populate the model for a template called example. App.ExampleRoute = Ember.Route.extend({ model: function() { var url = "example/GetExamples"; return Ember.$.getJSON(url).then(function(data) { return data; }); } }); The example template perfectly renders this data. Now my backend might change from time to time as I have another template called addExample. It just sends a JSON request to the server to add an entry in the database from this other template. After

Ember template chaining

我只是一个虾纸丫 提交于 2019-12-24 10:45:34
问题 I have this HTML/Handlebars code, what I would like is for the "outlet fav" to render the template with id "fav" and its corresponding outlet/templates-chain with expected "index". Kinda like displaying a different Ember URL as a part of the index. Is it possible natively(Without supplementing an iframe, which I think is a bad idea)? would it be considered a good practice(I know using views might help but just wondering if it is ok to walk this road)? <script type="text/x-handlebars" id=

How to test an Ember model's computed property that has relations dependencies?

与世无争的帅哥 提交于 2019-12-24 10:40:04
问题 I'm writing Qunit tests to test An Ember model, but having a hard time testing computed properties that have a relation dependency (the computed property triggers another model's computed property). The model that am testing (CoffeeScript): Customer = DS.Model.extend firstName: DS.attr('string') lastName: DS.attr('string') phones: DS.attr('embedded-list') phone: (-> @get('phones.firstObject.number') ).property('phones.firstObject.number') fullName: (-> [@get('lastName'), @get('firstName')]

How to use ember data with nested hasMany relationships?

有些话、适合烂在心里 提交于 2019-12-24 10:38:54
问题 I have some data models that look like this: App.Order = DS.Model.extend({ name: DS.attr('string'), legs: DS.hasMany('leg', {async: false}) }); App.Leg = DS.Model.extend({ name: DS.attr('string'), order: DS.belongsTo('order'), stops: DS.hasMany('stop', {async: false}) }); App.Stop = DS.Model.extend({ name: DS.attr('string'), leg: DS.belongsTo('leg'), }); The returned JSON looks like this: { "orders": [ { "id": 1, "name": "Order 1", "legs": [] }, { "id": 2, "name": "Order 2", "legs": [1] }, {

Route refresh in ember does not clear input controls content

你离开我真会死。 提交于 2019-12-24 10:37:59
问题 In a template i have many input controls like text box. I want to refresh the page, so i called this.refresh(); in the corresponding route's actions hash. Route is getting refreshed (model hook is fired..), but the user entered text in text boxes do not disappear. Then what is the point in refreshing? How to make the input controls appear as it is like when the route was loaded first time? 回答1: You need to associate that those properties in model/controller. and reset model properties in