ember-cli

Can't access Ember's class variable

半腔热情 提交于 2019-12-11 16:31:20
问题 How to properly pass a variable to an Ember's class? Controller: import Controller from '@ember/controller'; import Object from '@ember/object'; function totalVotes(company) { return company.upvotes + company.downvotes; } function calcPercent(company) { return (company.upvotes * 100 / (company.upvotes + company.downvotes)).toFixed(2); } function percentComparator(a, b) { return calcPercent(b) - calcPercent(a); } var Company = Object.extend({ score: function() { return (this.get('upvotes') *

Ember AWS deploy failing - CredentialsError & EHOSTUNREACH

我的梦境 提交于 2019-12-11 14:42:45
问题 Having trouble getting the ember-cli-deploy addon to deploy successfully to our AWS development environment. The pipeline seems to fail resulting in one of two errors: ... - build ok | +- didBuild | +- willPrepare | +- prepare | | | +- revision-data - creating revision data using `version-commit` - generated revision data for revision: `0.1.9+4a4f79a3` | +- didPrepare | +- fetchInitialRevisions | | | +- s3-index | +- didFail CredentialsError: Missing credentials in config CredentialsError:

Send actions to parent component?

℡╲_俬逩灬. 提交于 2019-12-11 13:14:48
问题 I've a template like this: {{#the-table}} {{#the-row selectedRow=selectedRow selectRow="selectRow"}} <td>something</td> {{/the-row}} {{/the-table}} When I click on the-row , an action ( selectRow ) is fired. I would expect the-table to receive the action, but instead it's the parent view/component the receiver. How can I change this behavior? 回答1: Inside your the-table your yield statement should yield the context of the-table : {{yield this}} . And then you should target the table from the

Combining two emberjs apps

你离开我真会死。 提交于 2019-12-11 12:55:06
问题 I am currently using ember 1.13. I have two apps which use emberjs. Now I am thinking of integrating these two apps by creating a new route in the first app and display specific route of the second app. Many suggested to use ember-engines,but they need ember 2.10 or higher.Since my application mostly depends on IE 8,I cannot migrate from ember 1.x. So what should I do? Thanks in advance!! Cheers!!! 回答1: So one approach that would work pre engines is to leverage an addon for the common routes.

Naming Mixins with Ember-CLI

爱⌒轻易说出口 提交于 2019-12-11 12:37:35
问题 I have an ember addon which uses several Mixins to provide its functionality. Unfortunately when I look at this object in the Ember Inspector I get a boat load of "unknown mixin" buckets where my state is scattered across: I'm ok with there being a lot of "buckets" but I'd really like to have them named. How does one go about doing that when working within the Ember-CLI context/environment. p.s. I'm on Ember-CLI 0.2.3 with Ember 1.11.1 and the latest build of Ember Inspector (as of 11 Apr

How can I unit test a method that results in an Action

故事扮演 提交于 2019-12-11 12:08:56
问题 In my Ember application, I have a simple form component, with the following behavior (snippet): ... let searchText = this.get('searchText') && this.get('searchText').trim().toLowerCase(); this.sendAction('searchTextChanged', searchText); ... How can I unit test this functionality in a qunit test? I'm unable to figure out how to listen for the action result . I'm using the test functionality that comes with ember-cli -- qunit, the helpers, etc. 回答1: Ember has a guide on how to do that here. I

Ember-cli get relative path of a dependency

独自空忆成欢 提交于 2019-12-11 12:04:01
问题 I have a unique issue that I can't get out because of how ember works with the dependencies. I am using this lib to check a phone number : https://github.com/Bluefieldscom/intl-tel-input/#utilities-script And it's working fine, until that I have to set the relative path of a file call util.js like this to make some options works: $phoneInput.intlTelInput({ allowExtensions: false, autoFormat: true, autoHideDialCode: false, nationalMode: false, utilsScript: "/bower_components/intl-tel-input/lib

Ember data Rest adapter error handling not working

陌路散爱 提交于 2019-12-11 11:57:08
问题 I have a basic Ember app and I am trying to handle validation errors on save (model is using the REST Adapter). In my route I am doing: task.save().then( function() {alert("success");}, function() {alert("fail");} ).catch( function() {alert("catch error");} ); When the record is valid I get the "success" alert, but when record is invalid, I do not get the "fail" alert OR "catch error". In the console I get: POST http://localhost:8080/api/tasks 422 (Unprocessable Entity) Error: The adapter

How do I rerender this img element?

佐手、 提交于 2019-12-11 11:48:35
问题 I'm sending the API a remote image url. The API does some image processing, then uploads to AWS S3. If successful, it returns the url to the image in response.data.attributes['image-url'] My controller has: imageUrl: Ember.computed.oneWay('model.imageUrl'); actions: { uploadImage(imageUrl) { Ember.$.ajax({ url: `api/v1/users/1/update-image`, type: 'PUT', data: { data: { attributes: { 'image-url': imageUrl } } } }) .success(response => { this.set('imageUrl', response.data.attributes['image-url

Uncaught Error: Could not find module `-private/system/references/record` imported from `ember-data/-private/system/references`

馋奶兔 提交于 2019-12-11 11:26:49
问题 When I upload my demo project, built with the following command: ember build --environment=production with data coming from ember-cli-mirage (configured to work also in production, with the method mentioned here: http://www.ember-cli-mirage.com/docs/v0.1.x/server-configuration/#environment-options I get this error: Uncaught Error: Could not find module `-private/system/references/record` imported from `ember-data/-private/system/references` I'm not sure which files would be relevant here I