Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 角流星出版_Angularjs_Meteor - Fatal编程技术网

Angularjs 角流星出版

Angularjs 角流星出版,angularjs,meteor,Angularjs,Meteor,我使用的是angular meteor和酷酷的publish composite软件包。我有聊天室,在聊天室下面我有相关的联系人。我正在聊天文档中存储联系人ID。我是这样出版的: Meteor.publishComposite('chats', function () { if (! this.userId) { return; } return { find: function() { return Chats.find({ userIds: this.userId

我使用的是angular meteor和酷酷的publish composite软件包。我有聊天室,在聊天室下面我有相关的联系人。我正在聊天文档中存储联系人ID。我是这样出版的:

Meteor.publishComposite('chats', function () {
 if (! this.userId) {
   return;
 }

 return {
  find: function() {
    return Chats.find({ userIds: this.userId });
  },
  children: [
    {
     collectionName: 'relatedContacts',
      find: function(chat) {
        let contactIds = [];
        if (chat.contactIds) {
          contactIds = chat.contactIds;
        }
        return Contacts.find({ _id: { $in: contactIds } });
      }
    }

  ]
}
}))

现在,我正试图在视图中显示我的联系人,但它似乎再也不会返回任何内容。这是我的密码:

RelatedContacts = new Mongo.Collection('relatedContacts');

var app = angular.module('MyApp').controller('ACtrl',
function($scope, $stateParams, $meteor) {

$scope.chat = $meteor.object(Chats, $stateParams.chatId);
$scope.contacts = RelatedContacts.find();

我不知道为什么会出现空白。任何帮助都会很好。谢谢。

我真的让它工作了。在我尝试访问相关文档之前,没有加载聊天对象。是否在meteor.isServer()中使用代码包装?