ember.js

Emberjs: cross-controller binding failing because 'content' doesn't exist yet

六月ゝ 毕业季﹏ 提交于 2020-01-05 07:57:45
问题 I'm trying to use the 'needs' feature to allow one controller to obtain a value from another. Here's a JSFiddle that shows a stripped-down version of my app before binding a value: http://jsfiddle.net/kevinwh/WRxnE/4/ App.ApplicationController = Ember.ObjectController.extend({ init: function() { this._super(); }, dishClicked: function() { console.log('clicked'); this.incrementProperty('clickCount'); } }); App.DishController = Ember.ObjectController.extend({ needs: ['application'], init:

ember integration test error. dealing with asynchronous side-effects

放肆的年华 提交于 2020-01-05 07:51:00
问题 I'm trying ember's integration testing package (http://emberjs.com/guides/testing/integration/) but I am getting this error 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 I've made a JSBin to reproduce this error: http://jsbin.com/InONiLe/9, which we can see by opening up the browser's console. I believe what's causing this error is the line data.set('isLoaded', true); in

ember integration test error. dealing with asynchronous side-effects

岁酱吖の 提交于 2020-01-05 07:49:54
问题 I'm trying ember's integration testing package (http://emberjs.com/guides/testing/integration/) but I am getting this error 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 I've made a JSBin to reproduce this error: http://jsbin.com/InONiLe/9, which we can see by opening up the browser's console. I believe what's causing this error is the line data.set('isLoaded', true); in

Emberjs - how to properly modify records on a model that has been set as a property in the controller?

非 Y 不嫁゛ 提交于 2020-01-05 07:49:50
问题 My template: {{#each test11}} {{businessname}} {{/each}} My controller that works: // businessmatches is a model that is set as a controller property in the router test11: function () { var raw = this.get('businessmatches'); // I want to be able to get all the records, filter them etc etc and then // make them available to the template return [ Ember.Object.create(raw.content.get(0)._data) ]; }.property('businessmatches'), raw.content.get(0)._data feels like a hack, so I must be missing the

Get Ember-Data REST response value

非 Y 不嫁゛ 提交于 2020-01-05 07:47:13
问题 Ember: 1.0.0-rc.6 Ember-Data: e999edb (2013-07-06 06:03:59 -0700) I make a REST call (POST) to login a user. Server response is ok. I need the ID from the server, but i only got the ID with "setTimeout". I think this is not the right way. What is my mistake? Within Controller i call: var login = App.Login.createRecord(this.getProperties("email", "password")); login.on("didCreate", function(record) { console.log(record.get("id")); // ID is null console.log(record.get("email")); }); setTimeout

Testing Emberjs app using QUnit and Karma fails due to `ReferenceError: Faye is not defined`

旧时模样 提交于 2020-01-05 07:46:38
问题 I Was testing EmberJs application with Qunit and karma runner and it was working all good. Then I had to integrate faye into the application which went well but then on running my test suite, it shows following error and crashes: ReferenceError: Faye is not defined The error is thrown where, I am defining the client in emberjs client = new Faye.Client(uri); Though this works in development, staging but not in testing. Overhere, uri = "http://localhost:9292/faye" faye.js is included in vendor

Invalid Version: Ember-Cli-Babel

我只是一个虾纸丫 提交于 2020-01-05 07:17:12
问题 Tried upgrading my ember project from ember 2.12.2 to 2.13.2 but I get the following error when I run ember init Invalid Version: https://registry.npmjs.org/ember-cli-babel/-/ember-cli-babel-6.1.0.tgz TypeError: Invalid Version: https://registry.npmjs.org/ember-cli-babel/-/ember-cli-babel-6.1.0.tgz at new SemVer (/Users/code/website/node_modules/semver/semver.js:293:11) at Range.test (/Users/code/website/node_modules/semver/semver.js:1036:15) at Function.satisfies (/Users/code/website/node

Ember ActiveModelAdapter customization

北战南征 提交于 2020-01-05 06:52:31
问题 My Ember application interacts with an API (through a DS.ActiveModelAdapter adapter) which respond to GET "/api/v1/users?username=mcclure.rocio" with a JSON like: { "user": { "id": 5, "name": "Rocio McClure", "username": "mcclure.rocio", "email": "rocio.mcclure@yahoo.com" } } My router is: Router.map(function() { this.route("login"); this.route("user", {path: "user/:username"}, function() { this.route("profile"); }); }); So I have route like http://localhost:4200/user/mcclure.rocio which is

how to create a right structure for nested routes in ember.js?

家住魔仙堡 提交于 2020-01-05 06:38:51
问题 I need to create an application with routes: /users - list of users /users/123 - user info /users/123/items - list of user items /users/123/items/456 - items info I wrote this code here $(function() { var App = window.App = Ember.Application.create({LOG_TRANSITIONS: true}); App.Router.map(function() { this.resource("users", {path: '/users'}, function() { this.resource("user", {path: '/:user_id'}, function() { this.resource("items", {path: '/items'}, function() { this.route("item", {path: '/

How can I programmatically add/remove models to a controller?

拟墨画扇 提交于 2020-01-05 06:33:23
问题 This shouldn't be too hard. I have a datepicker UI widget, and each time the user clicks on a month, I want to add or remove that month from the MonthsController (an ArrayController ). The MonthsController is not associated with a route, so in my ApplicationTemplate I simply have {{render months}} A simplified version of my datepicker view is App.DatepickerView = Ember.View.extend({ click: function(e) { var id = $(this).datepicker().data('date').replace(" ", "-"); this.get('controller