ember.js

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

Preferred way to retrieve data from a template in EmberJS

感情迁移 提交于 2019-12-24 06:37:45
问题 I'm trying to get some data out my templates to, let's say, add an user. This is what my view object looks like: Ember.View.create({ template: Ember.Handlebars.compile( UsersIndexTemplate ), addUser: function() { var value = $('#my-awesome-input').val(); } }) In theory I got my value already with jQuery, but is this the preferred way to go? 回答1: You should use bindings to bind the values in your template to properties on your view, see an example http://jsfiddle.net/pangratz666/uuvAp/:

How to resolve conflict between Embers Handlebar and Django Template

偶尔善良 提交于 2019-12-24 05:54:54
问题 I am using Ember and Django and quickly found out that the template delimiter in Handlebar conflicts with that of Django Templates. So i intsalled Django-embers http://pypi.python.org/pypi/django-ember/0.1 But It just not seem to work properly. This is the problem: If I have something like this in APP.js var Ab = Em.Application.create({ appDescription : 'HelloWorldApp' }); I can easily render it in the template like this {% load ember %} {% handlebars "" %} {{Ab.appDescription}} {%

Ember + HTMLBars: “boolean” bound attributes are not booleans

百般思念 提交于 2019-12-24 04:52:08
问题 I'm migrating an Ember 1.5 Handlebars app to current stable Ember and HTMLBars and it seems that a bound controller property must return "disabled" or null to work as expected with "disabled" DOM attributes. <button disabled={{isDisabled}}> In Handlebars isDisabled property is a boolean and all is well. In HTMLBars it seems I need: Ember.Controller.extend({ isDisabled: function() { if(this.get('itemSelected')){ return null; } else { return 'disabled'; } }.property('itemSelected') }); Is this

Ember + HTMLBars: “boolean” bound attributes are not booleans

半腔热情 提交于 2019-12-24 04:52:05
问题 I'm migrating an Ember 1.5 Handlebars app to current stable Ember and HTMLBars and it seems that a bound controller property must return "disabled" or null to work as expected with "disabled" DOM attributes. <button disabled={{isDisabled}}> In Handlebars isDisabled property is a boolean and all is well. In HTMLBars it seems I need: Ember.Controller.extend({ isDisabled: function() { if(this.get('itemSelected')){ return null; } else { return 'disabled'; } }.property('itemSelected') }); Is this

Ember Component Testing

给你一囗甜甜゛ 提交于 2019-12-24 04:23:26
问题 I'm using Qunit and Karma for testing, but i cannot find the way to create Test for Ember component. Here is my code for test: test('Function',function(){ var test = App.MyComponent.create({ data:[{'a':'a'}] }); var result = test.get('buildingComponent'); equal(result, 'done', "function crushed because" + result); }); My component: App.MyComponent = Ember.Component.extend({ buildingComponent:function(){ return 'done' }.property('data') }); So how can i test my component? 回答1: I had a similar

EmberFire Authentication and ToriiFirebaseAdapter

痴心易碎 提交于 2019-12-24 04:19:08
问题 I've followed the EmberFire guide to setting up authentication with the torii provider and it works perfectly. I'm looking to store the users data in firebase after the user has been authenticated and to have access to the user object throughout the application. I have previously done this with ember awhile back but i'm unsure how to do it using the new torii provider. I'm thinking i should test wether the user is already stored in firebase in an initialiser function and then inject the user

Win 8.1, Vagrant, Chef, Ubuntu, Ember-cli, ember new “npm ERR! tar.unpack untar error /home/vagrant/.npm/”

安稳与你 提交于 2019-12-24 04:12:47
问题 I'm on Windows 8.1, with vagrant, Cheffile and everything works. Now I'm doing: npm install -g ember-cli and it's ok. But when I do this: ember new sample in vagrant folder (the same folder I can view in Windows) I receive this error: version: 1.13.8 Could not find watchman, falling back to NodeWatcher for file system events. Visit http://www.ember-cli.com/user-guide/#watchman for more info. installing app create .bowerrc create .editorconfig create .ember-cli create .jshintrc create .travis

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