I've got a meteor collection on the client side
Friends = new Meteor.Collection("Friends");
Meteor.subscribe("Friends");
I have a user authenticate with facebook and I want to grab a list of their friends:
FB.api("/me/friends? auth_token="+response.authResponse.accessToken,
function(response){
for (i = 0; i<response.data.length;i++){
Friends.insert(response.data[i]);
}
);
I have a function to get that list:
Template.Friends.all_friends = function(){
return Friends.find();
}
I have a template that would like to display all the friends on the screen:
<template name="Friends">
{{#each all_friends}}
<div id="{{id}}" class="friend">
<img src="http://graph.facebook.com/{{id}}/picture" />
{{name}}
</div>
{{/each}}
</template>
What appears to be happening on the page is that all the friends DO flash up on the screen for a split second then immediately the screen flashes back to blank.
In the javascript console the message appears once per friend I have (yes, it is more than zero, thanks for asking)
insert failed: 404 -- Method not found
So! What have I missed? Anyone?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…