简体   繁体   English

Ember.js ember-data findAll远程服务器上的对象

[英]Ember.js ember-data findAll objects on the remote server

Folks! 伙计们! Are there any examples of how ember-data and remote back-end server works together (separate applications - client-side with ember.js and abstractive back-end server, Rails for example)? 是否有任何示例说明ember-data和远程后端服务器如何协同工作(单独的应用程序-带有ember.js的客户端和抽象后端服务器,例如Rails)? And the second question here - how to make array attribute (array of objects) with ember-data model? 还有第二个问题-如何使用ember-data模型制作数组属性(对象数组)?

There is a guide on the Ember site, which provides a great explanation; 在Ember网站上有一个指南,提供了很好的解释。

http://emberjs.com/guides/models/finding-models/ http://emberjs.com/guides/models/finding-models/

If you're using Rails you will probably be using the REST Adapter 如果您使用的是Rails,则可能会使用REST适配器

http://emberjs.com/guides/models/the-rest-adapter/ http://emberjs.com/guides/models/the-rest-adapter/

This is a fully-functioning Ember app that uses ember-data and Rails: 这是一个使用ember-data和Rails的功能齐全的Ember应用程序:

https://github.com/dgeb/ember_data_example/ https://github.com/dgeb/ember_data_example/

The last example may look like the application is integrated, but the client-side and back-end are completely separate. 最后一个示例可能看起来像应用程序已集成在一起,但是客户端和后端是完全分开的。 To change where the adapter expects to be sending data you can define a namespace and /or a url in your adapter: 要更改适配器期望发送数据的位置,可以在适配器中定义名称空间和/或URL:

App.Adapter = DS.RESTAdapter.extend({
  url: "http://www.domain.com/path/to/remote_app/",
  namespace: "api/v1"
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM