我在cloud9 IDE下运行这个应用程序。流星1.3.2.4
流星名单:
角1.3.10
自动式1.0.7
es5-shim 4.5.10
不安全1.0.7
jquery 1.11.8流星-基准1.0.4
流动-经验1.0.4
蒙戈1.1.7
无功1.0.9
标准扫雷器-css 1.0.6
跟踪器1.0.13
my ./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>
My ./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());
});
my ./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?hash=c17a5a9…:12535 TypeError:无法读取未定义的属性“查找”
发布于 2016-05-19 00:20:35
您需要用通用代码定义List
集合,而不仅仅是在server.js中。另外,您不能将它称为Meteor.List
,您还需要导入它。
本教程展示了如何正确地完成所有这些工作:https://www.meteor.com/tutorials/angular/collections
https://stackoverflow.com/questions/37311259
复制相似问题