ember.js

event.context not set by {{action …}} when using {{#each …} (undefined)

ぃ、小莉子 提交于 2019-12-21 21:06:19
问题 I'm trying out Ember.js for the first time by roughly following the Ember.js guide, but I'm running into the following problem. Relevant code: https://gist.github.com/3257657 (for complete rails app, see: https://github.com/basveeling/ember-test) Context: I'm running the latest ember-rails build with the 1.0 prerelease ember.js. I'm using ember-data for the post model. Almost everything works in this app, except that the hrefs created by {{action showPost context="post" href=true}} have an

How to achieve model side-loading with JMS Serializer and Symfony2

佐手、 提交于 2019-12-21 20:54:07
问题 I'm building a project with Ember.js and Ember-data for the UI and Symfony2, FOSRestBundle and JMS Serializer for the backend JSON API. JMS Serializer always embeds nested models in its output, but Ember-data requires that the models are side-loaded. I can't find anywhere an example of configuring JMS Serializer to side-load models rather than embedding them. Of course, I could just write an adapter on the Ember-data side to transform the result, but I want to gain the benefits of side

How can I build a recursive view in Ember?

瘦欲@ 提交于 2019-12-21 20:17:18
问题 In my application I have an item called block which can contain and be contained by other block items. To keep things simple, lets say these blocks can be infinitely nested. I want to know if I can create recursive views corresponding to the blocks that are also nested. Each view will be rendered as a DIV containing its children and residing inside its parent DIV ? While the views are similar in terms of what they can contain, their actual content that will be obtained from the server can be

Ember: Adding input fields dynamically on click and reading the new data

你。 提交于 2019-12-21 19:56:47
问题 I have a page where i show user couple of questions and provide input field for answers. Also i have a button add a question . On clicking this, he can enter a question in the new input field and click save. so what i need is that, when he save, the newly entered question should also show up near the already shown questions. So i have the questions in the model import DS from 'ember-data'; export default DS.Model.extend({ challengeQuestions: DS.attr() }); Then i alias this in my controller

Ember - Return a promise from beforeModel not working with Qunit

雨燕双飞 提交于 2019-12-21 18:43:12
问题 In my ApplicationRoute I implement a beforeModel hook that does a server call to see if a valid session exists. If it does, then the app navigates to the 'dashboard' route, otherwise it goes to the 'login' route. I am trying to implement some tests and I can't seem to get it to work with QUnit. I keep getting: Assertion failed: You have turned on testing mode, which disabled the run-loop's autorun. You will need to wrap any code with asynchronous side-effects in an Ember.run Here is a plunker

Ember - Return a promise from beforeModel not working with Qunit

守給你的承諾、 提交于 2019-12-21 18:42:29
问题 In my ApplicationRoute I implement a beforeModel hook that does a server call to see if a valid session exists. If it does, then the app navigates to the 'dashboard' route, otherwise it goes to the 'login' route. I am trying to implement some tests and I can't seem to get it to work with QUnit. I keep getting: Assertion failed: You have turned on testing mode, which disabled the run-loop's autorun. You will need to wrap any code with asynchronous side-effects in an Ember.run Here is a plunker

Ember.js: how to analyze error in vendor.js

扶醉桌前 提交于 2019-12-21 18:02:03
问题 I've deployed my ember-cli app in stage environment to let teammates test the app. In the app I have implemented Ember.onerror to email me errors that occur in stage and in production environment. Ember.onerror = function(data) { Ember.$.ajax({ type: "POST", url: url + "/error", dataType: 'json', contentType: 'application/json', data: JSON.stringify({message: data.message, stacktrace: data.stack}), beforeSend: function (xhr, settings) { xhr.setRequestHeader('Accept', settings.accepts.json); }

Multiple Layouts in Ember.js?

随声附和 提交于 2019-12-21 17:40:39
问题 Coming from a Rails background, you can have multiple Layouts - for say, anonymous user pages and then authenticated pages. Is this possible with Ember? I've tried declaring a new templateName in my UsersRouter, with no avail. I've also checked this guide: http://emberjs.com/guides/views/adding-layouts-to-views/ But it doesn't seem to be working :/ 回答1: You can use {{render}} inside an if helper to show different layouts. For instance if you have an ApplicationController that has login and

How to integrate Twitter Bootstrap into an ember-cli app?

允我心安 提交于 2019-12-21 17:27:49
问题 I am using Ember 1.7.0 and trying to integrate the Twitter Bootstrap CSS Framework into an ember-cli app. I have seen some articles about this online, but most seem to be pretty outdated. As of today, I've managed to put information from articles online together and have come up with this. bower install --save bootstrap-sass-official Then check bower.json to see if something along the lines is included: "bootstrap-sass-official": "~3.3.1" Include the following lines in your Brocfile.js : app

Ember CLI: custom input helper

放肆的年华 提交于 2019-12-21 15:46:31
问题 I'm trying to extend Ember's TextField with UrlField so that if someone forgets to include http:// , it does it for them. Here's my View: views/input-url.js import Ember from 'ember'; export default Ember.TextField.extend({ type: 'url', didInsertElement: function() { this._super.apply(this, arguments); this.formatValue(); }, onValueChange: function() { this.formatValue(); }.observes('value'), formatValue: function() { var pattern = /^https{0,1}:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+/g; if (pattern