Angular 流星:MongoDB collections 未显示在 UI

Angular Meteor: MongoDB collections are not shown in the UI

我正在尝试将 angular-meteor 与 Meteor 一起使用,并遵循 https://www.meteor.com/tutorials/angular/collections

中的教程

我有以下代码文件:

index.html

<body ng-app="web-alerts">
  <div ng-include="'client/index.ng.html'"></div>
</body>

client/index.ng.html

<div ng-controller="AlertsListCtrl">
    <h1>Tasks:</h1>
    <ul>
        <li ng-repeat="webAlert in tasks">
            <b>{{webAlert.title}}</b>
            <p>Url: {{webAlert.url}}</p>
            <p>Emails: {{webAlert.emails}}</p>
            <p>Keywords: {{webAlert.keywords}}</p>
            <p>Frequency: {{webAlert.frequency}}</p>
        </li>
    </ul>
</div>

client/app.js

Tasks = new Mongo.Collection("tasks");


if (Meteor.isClient) {
  angular.module('web-alerts', ['angular-meteor']);

  angular.module('web-alerts').controller('AlertsListCtrl', ['$scope', '$meteor',
    function($scope, $meteor) {
      $scope.tasks = $meteor.collection(Tasks);
    }
  ]);
}

在 MongoDB 中,我向 collection 添加了一些项目。

meteor:PRIMARY> db.tasks.find()

{ "_id" : ObjectId("55fe7cbc330d5b4cfb52ed9e"), "title" : "aaa yyy zzzz", "description" : "desc goes here", "url" : "http://abcd.com", "keywords" : "abcd, efgh, ijkl", "emails" : "", "frequency" : 10 }

但是我在 UI 中没有看到 collection 数据。如果我在控制器中将静态数组分配给 $scope.tasks,它工作正常。

可能是什么问题?

提前致谢。

通过将 client/app.js 移动到根文件夹解决了这个问题。

谁能解释一下可能是什么问题?