LocalStorage数据适配器,并在emberjs中有很多关系 [英] LocalStorage Data Adapter and hasMany Relationship in emberjs

查看:109
本文介绍了LocalStorage数据适配器,并在emberjs中有很多关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我使用 LSA 的应用程序中,我需要在我的模型中使用关系例如,我有这样的发布和评论模型:

In my application im using LSA and im need to use relation in my model for example i have post and comment models like this :

App.Post = DS.Model.extend({
 title:DS.attr('string'),
 comments:DS.hasMany('comments')
});

App.Comments=DS.Model.extend({
 content:DS.attr('string'),
 post:DS.belongsTo('post')
});

我想知道要在帖子和评论之间创建一个小孩关系,以及如何更新帖子的公告

i want to know ho to create a child relationship between post and comments and how to update commnets of post.

推荐答案

我也一直在努力做到这一点。请参阅正确的持续方法是什么?具有Ember.js的子模型
由hasMany关系定义的Ember儿童突然变为嵌入式模型

I've also been struggling to do this properly. See What is the correct way to persist child model with Ember.js? and Ember children defined by a hasMany relationship suddenly change to embedded model

我最终写了我自己的修复问题found.请参阅此处的拉动请求: https://github.com/rpflorence/ember- localstorage-adapter / pull / 26

I ended up writing my own fix for the problems I found. See the pull request here: https://github.com/rpflorence/ember-localstorage-adapter/pull/26

这篇关于LocalStorage数据适配器,并在emberjs中有很多关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆