相关疑难解决方法(0)

使用本地连接的Meteor会导致错误:插入失败:404 - 找不到方法

我在客户端有一个流星集合

Friends = new Meteor.Collection("Friends");
Meteor.subscribe("Friends");
Run Code Online (Sandbox Code Playgroud)

我有一个用户通过Facebook验证,我想获取他们的朋友列表:

FB.api("/me/friends?    auth_token="+response.authResponse.accessToken,
    function(response){
        for (i = 0; i<response.data.length;i++){
            Friends.insert(response.data[i]);
    }
);
Run Code Online (Sandbox Code Playgroud)

我有一个函数来获取该列表:

Template.Friends.all_friends = function(){
    return Friends.find();
} 
Run Code Online (Sandbox Code Playgroud)

我有一个模板,希望在屏幕上显示所有朋友:

<template name="Friends">
    {{#each all_friends}}
    <div id="{{id}}" class="friend">
        <img src="http://graph.facebook.com/{{id}}/picture" />
        {{name}}
    </div>
    {{/each}}
</template>
Run Code Online (Sandbox Code Playgroud)

这似乎是在页面上发生的事情是,所有的朋友DO闪烁在屏幕上的一瞬间,然后立即在屏幕上闪烁回空白.

在javascript控制台中,每个朋友都会显示一条消息(是的,它大于零,感谢您的询问)

insert failed: 404 -- Method not found
Run Code Online (Sandbox Code Playgroud)

所以!我错过了什么?任何人?

collections client-side meteor

8
推荐指数
1
解决办法
4324
查看次数

标签 统计

client-side ×1

collections ×1

meteor ×1