ember-data

unable to edit a hasMany association child record in ember-data

别说谁变了你拦得住时间么 提交于 2019-12-24 06:58:36
问题 I have a Post which has many comments. The problem is that I am able to fetch all the comments but I am unable to fetch a single comment and as a result cannot edit a single comment. Since I can't fetch a single comment, It means I can't add a single record to the transaction or edit a single record. The comments is sideloaded and will not be backed by a route and I don't want a route for any of the comment related controllers . So I am setting the model for the CommentController in the

Ember data and mongodb state?

女生的网名这么多〃 提交于 2019-12-24 06:38:12
问题 According to http://emberjs.com/api/data/classes/DS.EmbeddedRecordsMixin.html Records without an id property are not considered embedded records, model instances must have an id property to be used with Ember Data. If thats so how would i use a model like: { "_id": "545b54f20dbd7015f015359a", "comments": [ { "msg": "what is this jelly", "time": "1415271666", "user": { "id": "53fefc9ee4b07d3fe92fc077", "username": "kfir124" } } ], "files": [ { "key": "1415271653

Ember.js quiz questions: save/delete hasMany data

六月ゝ 毕业季﹏ 提交于 2019-12-24 04:12:45
问题 I'm building a quiz generator as my first Ember project, but I'm struggling. I've been able to create, edit and delete quizzes and save them to localstorage, but I'm having trouble saving/deleting quiz questions for each quiz. I'm building it in Yeoman-Ember. I tried to add a demo to JSBin but it didn't work, so I've got a demo build here: http://test.richardwestenra.com/embertest/ and here's a zip containing the current state of the build: http://test.richardwestenra.com/embertest/dev.zip

Accessing Multiple Models with One Action

假装没事ソ 提交于 2019-12-24 03:52:46
问题 I have multiple models within my index route which I declared like so: App.IndexRoute = Em.Route.extend({ model: function(){ return Ember.RSVP.hash({ dogs: this.store.find('dog'), cats: this.store.find('cat') }) }) And I'm able to render them fine by doing this: <script type="text/x-handlebars" data-template-name="index"> {{render 'dogs' dogs}} {{render 'cats' cats}} </script> The problem I am facing now, is that I want to pass a single action from the index to specific actions on each of

Accessing Multiple Models with One Action

时光毁灭记忆、已成空白 提交于 2019-12-24 03:52:06
问题 I have multiple models within my index route which I declared like so: App.IndexRoute = Em.Route.extend({ model: function(){ return Ember.RSVP.hash({ dogs: this.store.find('dog'), cats: this.store.find('cat') }) }) And I'm able to render them fine by doing this: <script type="text/x-handlebars" data-template-name="index"> {{render 'dogs' dogs}} {{render 'cats' cats}} </script> The problem I am facing now, is that I want to pass a single action from the index to specific actions on each of

Formatting JSON using the RESTSerializer in the latest Ember Data version

爱⌒轻易说出口 提交于 2019-12-24 03:20:45
问题 I'm struggling to 'munge' my JSON into the correct format. To illustrate i've made a quick, JSfiddle. http://jsfiddle.net/chrismasters/NQKvy/638/ The format the server returns the data has a couple of differences to the preferred format recommended by Ember Data now. Here is the raw JSON output { "video": { "uuid": "8a660002-03c6-4b8e-bd8b-4ce28fa0dacd", "state": "pending", "theme": "basic", "resolution": "nHD", "title": "Test title", "track": { "uuid": "376fc3bb-d703-49e7-9d92-bce7f6bf8b56",

Where to add css and js files in ember-cli app?

痴心易碎 提交于 2019-12-24 02:16:16
问题 In rails, js files are located under app/assets/javascripts Similarly where to add js and css files in ember-cli app ? 回答1: app/styles/ should contain your stylesheets: Contains your stylesheets, whether SASS, LESS, Stylus, Compass, or plain CSS (though only one type is allowed, see Asset Compilation). These are all compiled into <app-name>.css If you need external JavaScript libraries, you should manage them in dependency sections of package.json and bower.json . You may have to include the

How to convert JSON to store object?

百般思念 提交于 2019-12-24 01:57:10
问题 I have a JSON object from my Spring backend. How do I create a data object in my Ember application store? I tried: createObject() { var _this = this; $.getJSON('http://localhost:8080/object/getCard?id=24').then(function(response) { _this.store.createRecord('cards/object/card', response); }); } JSON: { "id":24, "fullName":"qwerty", "form":"zzzzzzzzzzzz", "leader": { "id":23, "fullName":"testName test", "email":"emailTest" } } I have a model in Ember app export default DS.Model.extend({

Ember-data bootstrapping model objects

假装没事ソ 提交于 2019-12-24 00:27:08
问题 When bootstrapping Ember-data model objects with existing JSON that is not from a remote AJAX call, do I have to make the following 2 calls: App.store.load(App.Account, data); var account = App.store.find(App.Account, data.id); Is it not possible to create the Object in one step, similar to calling setProperties on an existing Ember object? Also, how would this work for creating a collection of Ember model objects? For example: var users = App.get('users'); App.store.loadMany(App.User, users)

Ember.js model to be organised as a tree structure

末鹿安然 提交于 2019-12-24 00:24:48
问题 I am learning Ember.js, using a Rails backend. I'm looking to set up a tree structure for relating a Group model to itself (Sub-Groups). Since it's pretty mature, I'd like to link up the Ancestry gem for consumption on the Ember side. Ancestry adds a string column called "ancestry" to my Group model, and returns a string of parent ids. How would one approach the setting up Ember models in this case? 回答1: I figured it out with some tinkering around with the group serializer and Ember model. #