ember.js

handlebar precompile version error in Ember rc5

二次信任 提交于 2020-01-04 05:25:12
问题 I'm upgrading to Ember rc5 from rc3, but I'm getting the following error: Uncaught Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version (>= 1.0.0-rc.4) or downgrade your runtime to an older version (== 1.0.0-rc.3) Here are the relevant lines in my gemfile, taken straight from the ember-rails README (except pulling the gem from git... it gives the same error whether I include that or not) gem 'ember-rails', git

Prevent certain event listeners from firing for an event but allow the parent listeners to fire

一世执手 提交于 2020-01-04 05:13:07
问题 Is there any way to prevent some of the listeners in an event's chain from firing for an event but allow others farther up the chain to fire? For instance i have this structure <body> <div id="1"> <div id="2"> <button>Click Me</button> </div> </div> </body> Lets say i have click event listeners attached to body, div#1, and div#2. Would it be possible at div#2 event listener to prevent the event making it to div#1 or any other listeners in between and allow the event to fire on the body

Ember-auth QUnit tests fail every second run

情到浓时终转凉″ 提交于 2020-01-04 04:45:16
问题 I have recently managed to get my ember-auth tests to pass, but it's not yet perfect, as the tests fail every second time (or if there are several tests running, every second test about authentication fails). I have created a small sample app to demonstrate the failure. You should be able to reproduce the failure by following these steps: 1. git clone https://github.com/pedrokost/ember_auth_testing_example.git 2. cd ember_auth_testing_example 3. ruby -run -e httpd . -p5000 # (or any HTTP

Polymorphic relationship with mixin

荒凉一梦 提交于 2020-01-04 04:45:10
问题 When using the hasMany and belongsTo relationships in Ember-Data, does it have to specify a class, or can I specify a mixin? For instance, I have an Attachement model that I want to link to some other models. Specifically, I want to assign Attachement s to Project s and Components . Can I use a mixin on Projects and Component and use that mixin as the inverse like below? App.Attachment = DS.Model.extend({ attachedTo: DS.belongsTo('canHaveAttachments', { inverse: 'attachments'}); }); App

How to get the value of a checkbox of a template in the controller in ember app

假装没事ソ 提交于 2020-01-04 04:44:06
问题 I am trying to find whether the checkbox is checked or not in a controller. Here's my template: <script type="text/x-handlebars"> {{view Ember.TextField valueBinding="firstname" placeholder="First Name"}} <input type="checkbox" name="remember_me"> Remember me </input> <button {{action save }}>Save</button> </script> Here's my controller: App = Ember.Application.create(); App.ApplicationController = Ember.Controller.extend({ save: function(){ //need to get the value of "remember_me" here alert

Upgrading Ember inside of Ember-CLI

走远了吗. 提交于 2020-01-04 04:24:10
问题 I've just created a new Ember-CLI app (v0.1.12), and noticed that the referenced version of Ember is v1.8.1 (bower.json). I'd like to get the recently released 1.10 goodness in my project. What steps do I need to take to do this? (I'm new to Ember, Ember-CLI, Bower & NPM.) 回答1: As per the release notes for Ember 1.10.0 To smoothly upgrade to 1.10 and HTMLBars, Ember-CLI users should update to a version at or after 0.1.12 and then remove their application's Handlebars dependency. You can do

emberjs 1.0.0pre4 how do you pass a context object to a resource “…Index” route?

时光总嘲笑我的痴心妄想 提交于 2020-01-04 04:19:19
问题 In a simple ember application I have a single resource ('detail') with an index template. In the application index template I have a button which calls transitionTo('detail',obj) on the index controller, where obj is the content item that was clicked. This passes obj as the model argument to my DetailRouter.setupController function, but NOT to my DetailIndexRouter.setupController function. How can I pass my context object all the way through to the 'leaf' route? I have seen a similar question

I get “Assertion failed: You must include an `id` in a hash passed to `push` ” when querying API

大兔子大兔子 提交于 2020-01-03 18:59:59
问题 I must have read every question on stack overflow regarding my issue and have not found a solution. I am very new to Ember and Node so please bear with me. The server responds with this format: { "_id" : "53fddf59d72f9b4d3a3e164a" "about" : [ {"from" : "foo"}, {"text" : "bar"}, ... ] } My model looks like this: App.About = DS.Model.extend({ from : DS.attr('string'), text : DS.attr('string'), ... } Adapter & serializer: App.ApplicationAdapter = DS.RESTAdapter.extend({ host: 'http://localhost

Ember Data - rollback if navigating away from a form

末鹿安然 提交于 2020-01-03 18:31:44
问题 My application has new / edit forms for a set of entities read from a backend. When I open such a form, and fill out / edit some fields, then navigate away, the records appear changed in the entity lists, even though I did not commit those changes. Reloading the app (which reloads the data from the backend) fixes the issue, but is not an option. I've tried doing some transaction rollbacks in the form view's willDestroyElement, but this seems fundamentally wrong since it gets called even after

Testing: how to assert between two sequential promises/run.laters? How to skip `run.later` waiting in tests?

会有一股神秘感。 提交于 2020-01-03 18:17:32
问题 Here's a simple component: App.FooBarComponent = Ember.Component.extend({ tagName: "button", status: "Ready", revertStatusPeriodMs: 2000, click: function() { this.set('status', 'Pending'); // A fake ajax this.run() .then( function() { this.updateStatus('Finished'); }.bind(this)) .catch( function() { this.updateStatus('Error'); }.bind(this)); }, run: function() { return new Ember.RSVP.Promise( function(resolve) { Ember.run.later( function() { resolve(); }, 500); }); }, updateStatus: function