我在cloud9 IDE下运行这个应用程序。流星1.3.2.4
流星列表:
角度1.3.10我的./client/main.html
<head>
<title>Joakenpo</title>
</head>
<body ng-app="joakenpo">
<h1>Joakenpo</h1>
<div ng-controller="MainCtrl">
<ul>
<li ng-repeat="person in list">{{person.name}}</li>
</ul>
</div>
</body>
我的./server/main.js
List = new Mongo.Collection('list');
Meteor.startup(() => {
console.log('Joakenpo running');
['John', 'Peter', 'Rachel'].map((name) => List.insert({ name: name }));
console.log(List.find().count());
});
我的./client/main.js
angular
.module('joakenpo', ['angular-meteor'])
.controller('MainCtrl', ($log, $scope) => {
$log.debug('main controller');
$scope.message = 'Module running';
$scope.helpers({
list() {
return Meteor.List.find({});
}
});
})
.run(($log) => $log.debug('Joakenpo Module Running'));
我的错误
?angular_angular.js散列= c17a5a9 ...:12535 TypeError:无法读取属性&#39;找到&#39;未定义的
答案 0 :(得分:0)
您需要在公共代码中定义List
集合,而不仅仅是在server.js中。此外,您无法将其称为Meteor.List
,您还需要导入它。
本教程介绍如何正确执行所有操作:https://www.meteor.com/tutorials/angular/collections