ember.js

Ember-Data Fixture Adapter

僤鯓⒐⒋嵵緔 提交于 2020-01-13 06:01:50
问题 Is there a commit method for the fixture adapter? What does it do? As my understanding goes store.commit() puts an API call when used with REST adapter. Can I use isLoaded property with fixture adapter? Basically I have 2 records in my controller called x and y and a property content that has many records of y type. Coffee code below: someMethod: (-> content.removeObject(y) ).('x.isLoaded') anotherMethod: -> //modify x Application.store.commit() When I call anotherMethod it updates x and runs

Deserialize with an async callback

こ雲淡風輕ζ 提交于 2020-01-13 06:01:13
问题 I'm overriding the deserialize method so I can load an object from the backend corresponding with the id. However, the way I get this object is asynchronous. Deserialize does not wait for my callback and returns automatically. Example: show: Em.Route.extend({ route: "/:id", deserialize: function(router, post) { var postController = router.get('postController '); postController.findById(post.id, function(post) { return post }); } The call to the backend is made but deserialize returns

Deserialize with an async callback

依然范特西╮ 提交于 2020-01-13 06:01:09
问题 I'm overriding the deserialize method so I can load an object from the backend corresponding with the id. However, the way I get this object is asynchronous. Deserialize does not wait for my callback and returns automatically. Example: show: Em.Route.extend({ route: "/:id", deserialize: function(router, post) { var postController = router.get('postController '); postController.findById(post.id, function(post) { return post }); } The call to the backend is made but deserialize returns

Ember Getting property from Controller in Model

房东的猫 提交于 2020-01-13 03:25:31
问题 I have a computed property on a model and in order to compute that I need a property from a controller (not the one that is controlling the model). I know there is needs: but this is just on a controller level. How could I get a property in Ember from a controller other than the one that is managing the model? I'm trying to do some formatting like the person that [asked this question][1] but I didn't succeed what has been suggested there. So I try to do the formatting on the model with a

Dynamically add js object to model array in 1.13

六月ゝ 毕业季﹏ 提交于 2020-01-12 11:45:54
问题 I have the following code: var msg = this.store.createRecord({text:'first title', createdAt: "2015-06-22T20:06:06+03:00" }) this.get('model.content').pushObject(msg); msg.save(); We create new record. Then push in it to the model to display. It worked perfectly in 1.9 version but after upgrading it to the newest 1.13 it breaks and shows this error: TypeError: internalModel.getRecord is not a function after some researches I came out to this solution this.get('messages.content').unshiftObject

ember.js: how to debug based on assets/vendor-*.js

不羁岁月 提交于 2020-01-12 10:21:53
问题 This is more of a general question, but I imagine others have encountered this problem as well -- see for instance this SO question: Ember.js: how to analyze error in vendor.js I am working on a larger Ember-based application, where, if errors occur, I sometimes get rather cryptic stack traces, similar to this sample: TypeError: e.indexOf is not a function at e.func (https://XXX/assets/vendor-c3ea8aab9a11f79411cf3b32532ea544.js:13:6039) at e.get (https://XXX/assets/vendor

Iterating over Ember.js ember-data Record Arrays

拜拜、爱过 提交于 2020-01-12 07:32:24
问题 I've been beating my head against this problem all day, and I feel like I'm close to a solution but just can't quite make it happen. I'm using Ember.js with Ember-Data and the Fixtures adapter, eventually migrating to a REST adapter. The basic problem is this: I have Sites and Supervisors, with a many-to-many relationship. I want to present the user with a select box for their existing site/supervisor pairings, sorted by site, ie: Site 1 - Supervisor 1 Site 1 - Supervisor 2 Site 2 -

Action handlers implemented directly on controllers are deprecated -how to correct this?

混江龙づ霸主 提交于 2020-01-12 06:41:32
问题 I just upgraded from ember.js RC7 to RC8 and found that a simple template (shown below) would throw a deprecated warning "Action handlers implemented directly on controllers are deprecated" {{input class="firstName" type="text" placeholder="first name" value=firstName }} {{input class="lastName" type="text" placeholder="last name" value=lastName }} <button class="submit" {{action addPerson}}>Add</button> <br /> <table> {{#each person in controller}} <tr> <td class="name">{{person.fullName}}<

How to use a custom authorizer and custom authenticator for ember simple-auth in ember cli

南笙酒味 提交于 2020-01-12 05:39:51
问题 I don't understand how I'm supposed to include my custom authenticator and custom authorizor with ember cli. Where to put it and what to include and how to do it. The cli example for simple-auth provided unfortunately does not cover custom authorizer and authenticator. The build is successfully, but when running it in the browser, I get the error TypeError: SimpleAuth.Authenticators is undefined I'm aware that I'm doing something wrong, but could you please guide me or point me to the right

Creating Web applications with Ember.js

淺唱寂寞╮ 提交于 2020-01-12 02:19:27
问题 I've just found out about Ember.js, and it looks interesting. I'd like to create a small notes app to learn how to use it. The basic layout I have in mind is to have categories, and each category can have notes. For the UI, there would be a sidebar with the categories which will be clickable, and the notes for the category will be displayed on the other side. But I can't quite figure out the whole template/layout system. The template system itself seems simple enough (similar enough to Rails