ember-data

Ember data not loading belongsto relationship using fixtures

六月ゝ 毕业季﹏ 提交于 2020-02-22 06:09:35
问题 I am working on a very basic ember app , but I can't seem to get it to display the belongsto model. My user model: News.User = DS.Model.extend({ username: DS.attr('string'), items: DS.hasMany('News.Item') }); News.User.FIXTURES = [ { "id": 1, "username": "Bobba_Fett", "items": [1,2] }] My item model: 'use strict'; News.Item = DS.Model.extend({ title: DS.attr('string'), url: DS.attr('string'), domain: DS.attr('string'), points: DS.attr('number'), comments: DS.hasMany('News.Comment'), user: DS

Ember data not loading belongsto relationship using fixtures

孤街醉人 提交于 2020-02-22 06:06:56
问题 I am working on a very basic ember app , but I can't seem to get it to display the belongsto model. My user model: News.User = DS.Model.extend({ username: DS.attr('string'), items: DS.hasMany('News.Item') }); News.User.FIXTURES = [ { "id": 1, "username": "Bobba_Fett", "items": [1,2] }] My item model: 'use strict'; News.Item = DS.Model.extend({ title: DS.attr('string'), url: DS.attr('string'), domain: DS.attr('string'), points: DS.attr('number'), comments: DS.hasMany('News.Comment'), user: DS

Ember data not loading belongsto relationship using fixtures

拈花ヽ惹草 提交于 2020-02-22 06:05:36
问题 I am working on a very basic ember app , but I can't seem to get it to display the belongsto model. My user model: News.User = DS.Model.extend({ username: DS.attr('string'), items: DS.hasMany('News.Item') }); News.User.FIXTURES = [ { "id": 1, "username": "Bobba_Fett", "items": [1,2] }] My item model: 'use strict'; News.Item = DS.Model.extend({ title: DS.attr('string'), url: DS.attr('string'), domain: DS.attr('string'), points: DS.attr('number'), comments: DS.hasMany('News.Comment'), user: DS

Ember js - Cannot generate URL with dynamic segments using urlFor method

橙三吉。 提交于 2020-02-05 14:56:16
问题 I am able to generate a URL using urlFor() when I’m in the route /1/1/orders . but I’m unable to generate a URL in the application route. So this code is not working: var routeName = "scope.purchase.invoice"; var dynamicSegments = { scopeId: 1, scopeData: 2, invoiceId: 3, pageSize: 20, pageIndex: 1 }; var url = this.router.urlFor(routeName, 1, 2, 3, 10, 1); console.log("inside generated url", url); For this router.js : this.route("scope", { path: '/:scopeId/:scopeData' }, function(){ this

Ember js - Cannot generate URL with dynamic segments using urlFor method

不打扰是莪最后的温柔 提交于 2020-02-05 14:55:27
问题 I am able to generate a URL using urlFor() when I’m in the route /1/1/orders . but I’m unable to generate a URL in the application route. So this code is not working: var routeName = "scope.purchase.invoice"; var dynamicSegments = { scopeId: 1, scopeData: 2, invoiceId: 3, pageSize: 20, pageIndex: 1 }; var url = this.router.urlFor(routeName, 1, 2, 3, 10, 1); console.log("inside generated url", url); For this router.js : this.route("scope", { path: '/:scopeId/:scopeData' }, function(){ this

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

Catch 404 error when using store.findQuery

六眼飞鱼酱① 提交于 2020-01-24 17:00:08
问题 I'm using Embers findQuery method and wonder how to catch 404 errors when there are no results? this.store.findQuery('customer', { hasProjects: true, getArchivedProjects: archived }).then(function(customers) { }); If the query is empty, the code inside this then function doesn't get fired, so I can't even check the type of customers . Example: this.store.findQuery('customer', { hasProjects: true, getArchivedProjects: archived }).then(function(customers) { console.log('foo') }); If the query

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