流星に新しい。アプリはうまく機能していてdbにdburlesを植え付けました:iOSとAndroid用のcordovaビルドと流星追加プラットフォームを実行し、すべての前提条件をインストールするまでは、factory。今私は以下のエラーが表示されます。私は流星の更新と流星のリセットを試みたが、それは救済するために何もしなかった。 コントローラbuilders.js流星=>コードで終了:8エラー
BuildersController = AppController.extend({
waitOn: function() {
return this.subscribe('builders');
},
data: {
poo: Builders.find({})
},
onAfterAction: function() {
Meta.setTitle('Builders');
}
});
BuildersController.events({
'click [data-action=doSomething]': function (event, template) {
event.preventDefault();
}
});
種builders.js
Meteor.startup(function() {
Factory.define('builder', Builders, {
name: function() { return Fake.sentence(); },
rating: function() { return _.random(1, 5); }
});
if (Builders.find({}).count() < 100) {
Builders.remove({});
_(200).times(function(n) {
Factory.create('builders');
});
}
});
出版builders.js
:=> Exited with code: 8
I20160623-16:15:58.340(-7)? 200
I20160623-16:15:58.341(-7)? 0
I20160623-16:15:58.342(-7)? 0
I20160623-16:15:58.343(-7)? 0
I20160623-16:15:58.344(-7)? 0
I20160623-16:15:58.345(-7)? 0
I20160623-16:15:58.345(-7)? 0
I20160623-16:15:58.346(-7)? 0
I20160623-16:15:58.347(-7)? 0
I20160623-16:15:58.347(-7)? 0
W20160623-16:15:58.395(-7)? (STDERR)
W20160623-16:15:58.396(-7)? (STDERR) /Users/johndow/.meteor/packages/meteor-tool/.1.3.4.zv5a90++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280
W20160623-16:15:58.396(-7)? (STDERR) throw(ex);
W20160623-16:15:58.396(-7)? (STDERR) ^
W20160623-16:15:58.423(-7)? (STDERR) Error: Factory: There is no factory named builders
W20160623-16:15:58.423(-7)? (STDERR) at Function.Factory.get (packages/dburles:factory/factory.js:29:11)
W20160623-16:15:58.423(-7)? (STDERR) at Function.Factory.build (packages/dburles:factory/factory.js:35:27)
W20160623-16:15:58.423(-7)? (STDERR) at Function.Factory.create (packages/dburles:factory/factory.js:119:23)
W20160623-16:15:58.424(-7)? (STDERR) at app/server/seeds/builders.js:11:15
W20160623-16:15:58.424(-7)? (STDERR) at Function._.times (packages/underscore/underscore.js:1093:1)
W20160623-16:15:58.424(-7)? (STDERR) at [object Object]._.(anonymous function) [as times] (packages/underscore/underscore.js:1149:1)
W20160623-16:15:58.424(-7)? (STDERR) at app/server/seeds/builders.js:10:12
W20160623-16:15:58.425(-7)? (STDERR) at /Users/johndow/Projects/jackpot/.meteor/local/build/programs/server/boot.js:304:5
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.
は、ここに私のJavaScriptファイルをですあなたのapp/server/seeds/builders.js
あなたが Fを定義するには
Meteor.publishComposite("builders", function(limit) {
return {
find: function() {
//set default limit
limit = limit || 30;
return Builders.find({},{limit: limit});;
}
// ,
// children: [
// {
// find: function(item) {
// return [];
// }
// }
// ]
}
});
コレクション
builders.js
Builders = new Mongo.Collection('builders');
Builders.helpers({
});
Builders.before.insert(function (userId, doc) {
doc.createdAt = moment().toDate();
});
HTML
<template name="builders">
<div class="template-builders">
<div class="page-header">
<h1>Builders</h1>
</div>
<h2>{{ pageTitle }}</h2>
<ul class="list-group">
{{#each poo}}
<li class="list-group-item">{{ name }} <span class="label label-default">{{ rating }}</span></li>
{{/each}}
</ul>
</div>
</template>
このSOLV私の問題を編集しました。ありがとう! –