내 유성 템플릿이 데이터를 가져 오지 않습니다. 그것은 라우트 된 것으로, 모든 핸들 바 필드에는 아무것도 표시하지 않습니다.Meteor 템플릿이 어떤 이유로 데이터를 가져 오지 않습니다. 구독시기에 대해 혼란스러운 경우
여기 내 라우터의 관련 부분이 있습니다. 내가 콘솔에서 Meteor.users.find().fetch()
같은 일을 할 때 오른쪽 필드 오른쪽 객체의 모든 팝업 때문에
this.route('admin', {
before: function() { if (!isAdmin()) Router.go('home'); },
data: function() { return Meteor.users.find(); },
waitOn: function() { return Meteor.subscribe('adminAllUsers'); }
});
this.route('adminUser', {
path: '/admin/:_id',
before: function() { if (!isAdmin()) Router.go('home'); },
// this is a potential problem area.
data: function() { return Meteor.users.find(this.params._id); },
waitOn: function() { return Meteor.subscribe('adminUser', this.params._id); }
});
내 출판물, 자신의 일을하고있을 것 같다. 관련 출판물을보고 싶으면 그냥 물어보십시오.
내 템플릿 :
<template name="admin">
{{#each this}}
// Here, since I'm using 'pathFor', it passes the id automatically. I'm not sure if that means I don't have to use the 'data' hook in the router.
<a href="{{pathFor 'adminUser'}}">{{customer.firstname}} {{customer.lastname}}</a>: ${{customer.balance}}
{{/each}}
</template>
<template name="adminUser">
Admin user
{{testing}}
// None of these show up, not even the id.
{{_id}}
{{customer.firstname}}
{{#each emails}}
{{address}}
{{/each}}
{{#with customer}}
{{firstname}} {{lastname}}
{{/with}}
</template>
또한 내 자바 스크립트에서이 도우미를 가지고는 :
Object {collection: LocalCollection, selector_id: "veW6jvfSM5Jc46Wbj", selector_f: function, sort_f: undefined, skip: undefined…}
때이 도우미는 로그를 수행 할 때
Template.adminUser.testing = function() {
console.log(this);
}
,이 인쇄 나는 거기에 모든 것을 가지고 있다는 것을 파고 들며, 그 경로는 selector_id
이다.
왜 아무것도 나타나지 않습니까?