I'm trying create a tweet. As you know, a tweet can be retweeted, lets look at my simplified model:
// # post-twitter model
export default DS.Model.extend({
message: DS.attr('string'),
retweet: DS.belongsTo('post-twitter', {async: false}),
});
retweet
property means: this tweet has(has-once) a tweet nesthed.
Here is some data example:
{
"post_twitter":[
{
"id":"1",
"message":"Im a tweet",
"retweet": "2", // This twitter has a retweet
},
{
"id":"2",
"message":"stackoverflowww!!!",
},
],
}
When I'm trying render this my browser die in a loop:
// post-tweet component
<div class="post">
{{post.message}}
{{#if post.retweet}}
{{debugger}}
{{/if}}
{{yield}}
</div>
While I debugging, post.retweet always is defined! debugging:
post = get('post')
rtw = post.get('retweet')
rtw2 = rtw..get('retweet') // Why? a self reference
Aucun commentaire:
Enregistrer un commentaire