私はログインユーザーの結果を返信する簡単なクイズアプリを作っています。ただし、ここではログインユーザーの代わりにすべてのユーザーの結果が返されます。返信ログインユーザーのスコアMeteor
Big5.attachSchema(new SimpleSchema({
cons8: {
label: "...is talkative",
type: Number,
optional: false,
autoform: {
afFormGroup: {
type: "select-radio-inline",
'formgroup-class': 'custom-radio-class',
options: function() {
return [
{label: "1", value: 1},
{label: "2", value: 2},
{label: "3", value: 3},
{label: "4", value: 4},
{label: "5", value: 5}
];
}
}
}
},
})
)
は、すべてのユーザーデータ検索:
<template name="personality">
<h1 class=personalityIntro>I see myself as someone who...</h1>
<div class="test">
{{> quickForm
collection="Big5"
id="insertPersonality"
type="method"
meteormethod="submitBig5Scale"}}
</div>
<div class="userRe">
<hr>
{{#each big5s}}
{{> showResult}}
{{/each}}
</div>
</template>
<template name="showResult">
<div class=testResult>
<h2>Neuroticism: {{>neurotic cons8}}</h2>
</div>
</template>
<template name="showResult">
<div class=testResult>
<h2>Neuroticism: {{>neurotic cons8}}</h2>
</div>
</template>
この
は、私は私のデータを格納する方法であるbig5s: function(){
return Big5.find()
}
})
リターンをログイン・ユーザーの結果のみ:あなたが保存
Template.neurotic.helpers({
add: function(cons8){
return Meteor.user().big5s.cons8
}
})
もしあなたが 'cons8'パラメータを使う必要があれば、このようにする必要があります:' Meteor.user()。big5s [cons8] 'しかし、まだ戻り値は全く間違っているようです。 – user3142695
スキーマでは、ユーザー単位でデータを保存していますか? – zim
UserResult =新しいMongo.Collection( 'user_result'); – Lucia