ember-cli

Cannot read property 'determineRelationshipType' when trying to save() Model with hasMany Relationship

末鹿安然 提交于 2020-02-03 10:41:05
问题 I'm running into a tough bug when trying to save a record with the LocalStorage Adapter that has a hasMany relationship (Using Ember CLI). What I'm trying to do is save a product to a bag when a user clicks on a "Add to Bag" button. I'm getting this error in my console: Uncaught TypeError: Cannot read property 'determineRelationshipType' of undefined Product Model: import DS from 'ember-data'; export default DS.Model.extend({ ... bag: DS.belongsTo('bag') }); Bag Model: import DS from 'ember

Ember-CLI on Apache TOMCAT

↘锁芯ラ 提交于 2020-02-02 06:03:53
问题 I am trying to load my ember-cli inbuilt server application on Apache tomcat. I built my application in production mode using ember build --environment production I moved the files in my /dist folder to my apache tomcat /webapps folder started my apache server but when i go to the URL: "localhost:8081/index.html" The page is blank although the it works perfect with the inbuilt server. Using Ember inspector i can see the routes that are defined but not able to view any output. I followed this

Ember.js embedded records don't work

烈酒焚心 提交于 2020-01-25 12:44:45
问题 I have a json like { "meta":{ "per":20, "page":1, "total":2 }, "users":[ { "id":119506, "first_name":"erglk", "last_name":"wfe", "email":"bent@exemple.com", "groups":[ { "id":5282, "name":"test" }, { "id":8880, "name":"everybody" } ] }, { "id":119507, "first_name":"eriglk", "last_name":"wife", "email":"benit@exemple.com", "groups":[ { "id":5284, "name":"testf" }, { "id":8880, "name":"everybody" } ] } ] } For the moment no problem to access the user but I have some difficulties to access the

Ember alternative to query params with service

主宰稳场 提交于 2020-01-25 07:47:10
问题 So I have a route with this model: model() { var self = this; return RSVP.hash({ comptes : this.get('store').findAll('compte'), contrats: this.get('store').findAll('contrat').then(function(contrats) { return contrats.filterBy("contrat_fk.id", self.get('currentContract.contrat.id')); }), }) } My goal is to filter the model contrat with the value provided by my service currentContract. It works fine when the page is reloaded, but when I change the route and comeback to this route, the model

Ember invoking closure action

有些话、适合烂在心里 提交于 2020-01-25 00:21:11
问题 In Ember JS, say I have a component defined as below (HBS/JS) parent.hbs {{longclaw-sword attack=(action swing)}} app/components/longclaw-sword.js export default Ember.Component.extend({ click() { this.attack(); } }); Is there any difference between calling the closure action using this.attack() V/s this.attr.attack() ? In which cases is "attr" used ? Can it be used for reference to normal properties OR is it only for actions ? 回答1: attr is kinda unofficially deprecated afaik. in the upcoming

Mocking HTTP requests in ember-qunit

安稳与你 提交于 2020-01-24 22:06:03
问题 In an ember-cli app, testing is done using ember-qunit. I would like to mock HTTP requests, but have not been able to find a recommended way of doing this in the documentation. I have found this thread which discusses this, but it appears to be out of date (for ember-cli anyway). How do you mock HTTP requests? 回答1: This is how I mock HTTP requests. One improvement could be done by encapsulating mockjax with helper like: function stubEndpointForHttpRequest(url, json) { $.mockjax({ url: url,

Mocking HTTP requests in ember-qunit

删除回忆录丶 提交于 2020-01-24 22:05:26
问题 In an ember-cli app, testing is done using ember-qunit. I would like to mock HTTP requests, but have not been able to find a recommended way of doing this in the documentation. I have found this thread which discusses this, but it appears to be out of date (for ember-cli anyway). How do you mock HTTP requests? 回答1: This is how I mock HTTP requests. One improvement could be done by encapsulating mockjax with helper like: function stubEndpointForHttpRequest(url, json) { $.mockjax({ url: url,

Ember fixtures not working

懵懂的女人 提交于 2020-01-23 18:38:09
问题 This is my code (using ember-cli): app.coffee `import Ember from 'ember'` `import Resolver from 'ember/resolver'` `import loadInitializers from 'ember/load-initializers'` Ember.MODEL_FACTORY_INJECTIONS = true App = Ember.Application.extend modulePrefix: 'dashboard' # TODO: loaded via config Resolver: Resolver loadInitializers App, 'dashboard' `export default App` adapters/application.coffee `import DS from 'ember-data'` ApplicationAdapter = DS.FixtureAdapter.extend() `export default

Why the ember-cli is so slow

大兔子大兔子 提交于 2020-01-22 14:16:09
问题 I migrated my grunt project to ember-cli, I found the time from file modification to liveload completion was so long, about 10 minutes. After I installed ember-cli-windows, ember-cli-windows-addon, no obvious prompt was gained. The following is one example output after ember-cli-windows, ember-cli-windows-addon installed: file changed routes\services.js Build successful - 382781ms. Slowest Trees | Total ----------------------------------------------+--------------------- Babel | 82175ms

Using LoDash with EmberCLI

◇◆丶佛笑我妖孽 提交于 2020-01-22 13:56:25
问题 Does anyone have a working example of a (simple) ember-app project built using Ember-CLI that uses LoDash? (e.g.: I want to use lodash, _.someLodashFunc, in my Routes and Controllers). I haven't seen any thread / article on the web that gives clear, step-by-step explanation on how to do that. If possible with lodash v3.0.0 (and I'm using the latest ember-cli, v0.1.9). Thanks, Raka I found out how, you need to generate a custom build of lodash (the "lodash modern"). Use lodash-cli: https:/