ember.js

Unable to query Emberjs Model when using DS.FixtureAdapter

只愿长相守 提交于 2019-12-21 03:38:19
问题 I'm unable to query my models. I don't know what I'm doing wrong. I have my store defined as App.Store = DS.Store.extend({ revision: 12, adapter: DS.FixtureAdapter }); And my model defined, var Feature = DS.Model.extend({ name: DS.attr('string'), description: DS.attr('string'), parent: DS.belongsTo('SimpleTestManager.Feature'), DS.belongsTo('SimpleTestManager.Project'), children: DS.hasMany('SimpleTestManager.Feature'), requirements: DS.attr('string') }); App.Feature.adapter = DS

Multiple routers in ember.js?

穿精又带淫゛_ 提交于 2019-12-21 03:37:14
问题 In my app I have a requirement for a functional area to open in an overlay such that it sits on top of the current route which could be almost any other route in the app. This functional area will have it's own routes as it contains at least a master-detail view. What is the current best practice for dealing with this situation? Is it possible to have top-level routes that don't tear down the current route/views when entering them? If not and it's necessary to have the ApplicationController

Ember model reloading in interval

一世执手 提交于 2019-12-21 03:34:11
问题 I have a User model, which has latitude and longitude properties, which are used to show current user location on map. App.User = DS.Model.extend({ firstName: DS.attr('string'), lastName: DS.attr('string'), email: DS.attr('string'), jobs: DS.hasMany("App.Job"), latitude: DS.attr('number'), longitude: DS.attr('number'), measuredAt: DS.attr('date'), }); What is the best way to autoupdate latitude and longitude properties from server every given interval? Does ember-data support this kind of use

Delete JSON root element for POST/PUT operations in Ember Data

旧城冷巷雨未停 提交于 2019-12-21 03:28:42
问题 I'm consuming a web service that in POST/PUT verbs expects a JSON like this: { "id":"CACTU", "companyName": "Cactus Comidas para llevar", "contactName": "Patricio Simpson", "contactTitle": "Sales Agent", "address": "Cerrito 333", "city": "Buenos Aires", "postalCode": "1010", "country": "Argentina", "phone": "(1) 135-5555", "fax": "(1) 135-4892" } But Ember Data sends a JSON like this: { "customer": { "id":"CACTU", "companyName": "Cactus Comidas para llevar", "contactName": "Patricio Simpson",

emberjs Cannot clone an Ember.Object that does not implement Ember.Copyable

做~自己de王妃 提交于 2019-12-21 03:26:13
问题 I am using ember 1.3.1 and ember-data 1.0.0-beta.5. On creating new mode I get following error Assertion failed: Cannot clone an Ember.Object that does not implement Ember.Copyable Following is my model code App.myModel = DS.Model.extend({ name : DS.attr('string'), age : DS.attr('string') }); In my create route model function return Em.Object.create({}); and finally on save I do following this.store.createRecord('property', this.get('model')); Although despite the error, my backend service is

Collection of objects of multiple models as the iterable content in a template in Ember.js

ぐ巨炮叔叔 提交于 2019-12-21 02:58:07
问题 I am trying to build a blog application with Ember. I have models for different types of post - article, bookmark, photo. I want to display a stream of the content created by the user for which I would need a collection of objects of all these models arranged in descending order of common attribute that they all have 'publishtime'. How to do this? I tried something like App.StreamRoute = Ember.Route.extend({ model: function() { stream = App.Post.find(); stream.addObjects(App.Bookmark.find());

“Dynamic segment” in Ember.js?

穿精又带淫゛_ 提交于 2019-12-21 02:52:25
问题 Throughout the Ember.js documentation, one finds the concept of dynamic segment mentioned at several places. What does it mean? 回答1: Updating with a proper sample: Demo | Source Edit due to questions in comments: In Ember, think of the Router mechanism as a State Machine: Each Route can be seen as a State. Sometimes tho, a state can have it's own little state machine within it. With that said: A resource is a state which you have possible child states. A PersonRoute can be defined as either

Does a pagination mixin exist for ember.js yet?

牧云@^-^@ 提交于 2019-12-21 02:47:11
问题 I've been writing my own pagination logic that would be similar to the Ember.SortableMixin but with support for paging. Does anything like this exist yet in the pre 1.0 build? If this doesn't exist is a pull request welcome around this specific behavior? It's my guess that 90% of apps out there need simple pagination/sorting and having a mixin built in would cut out almost 60+ lines of code. Thank you in advance Update I replied to another "ember/ pagination" question and my full blown

ember.js displaying list of items, each item with it's own view/controller

允我心安 提交于 2019-12-21 02:38:10
问题 What I want to achieve: create controller with view, and in this view I have list of 'Gallery' objects. Each item has it's own view and controller. All files are here: https://gist.github.com/7e72bb2f532c171b1bf3 It works as intended, after hovering some text is shown/hidden, but personally I think that this it's not so good solution. I think that I maybe should use {{collection}} helper, but there is no documentation for it on ember.js page (there is some in code, but I'm not sure if this

Ember.js routing: how do you set a default route to render immediately?

∥☆過路亽.° 提交于 2019-12-21 00:14:45
问题 I'm sure this will become clear as I dig in deeper, but for now it's not obvious how to make this happen. I was following the info on this helpful SO article about routing but there is an important piece missing from the example, i.e. how do you get the 'home' view to render right away without having to click the 'home' link? I've started digging into the docs to try to make sense of this, but meanwhile it seems like a useful question to have answered for posterity. I've been playing with the