handlebars.js - Meteor template not getting it's data for some reason. Confused about when to subscribe -
My meteor template is not receiving its data. It is a root user, and it does not have anything for all its handler fields Not showing.
Here are the proper parts of my router.
this.route ('admin', {before: function} (if (! IsAdmin ()) router.go ('home') ;}, Data: function () {return meteor.users.find ();}, wait: function () {mention meteor.subscribe ('adminAllUsers');}}); this. Root ('adminUser', {path: '/ admin /: _ id', first: function () {if (! IsAdmin ()) Router.go ('home');}, // This is a potential problem area : Function () {return Meteor.users.find (this.params._id);}, wait: function () {return Meteor.subscribe ('adminUser', this.params._id);}});
My publications are doing their job, since I talk like Meteor.users.find (). In the fetch ()
console, pop up all the objects with the right areas, if you want to see that relevant publication only asks.
My templates:
& lt; Template Name = "Admin" & gt; {{#each this}} // Here, because I am using 'pathfour', this id passes automatically. I'm not sure that it means that I do not have to use the 'data' hook in the router. $ {{Customer.balance}} {{/ each}} & lt; / Template & gt; & Lt; Template Name = "Admin User" & gt; The admin user {{testing}} // does not appear either, nor even the ID. {{_id}} {{customer.firstname}} {{e-mail}} {{address}} {{each}} {{with customer}} {{first name}} {{last name}} {{/ With}} & lt; / Template & gt;
And it is also helpful in my javascript:
Template.Adminuser Testing = function () {Console.log (this); }
When this assistant logs in, it prints:
object {collection: local collection, selector_id: "veW6jvfSM5Jc46Wbj", selector_f : Function, sort_f: undefined, skip: undefined ...}
When I dig that everything is in it, and it is correct for the selector_id
route is.
Why is not anything visible?
This is a simple, data controller of a root controller, the current data reference of the provided template Will be used in
Your administrator route is fine, because you return local cusor from the collection. You search and you get repeated on the cursor using {{#each this}}.
However in the admin user, you are also returning the local cursor but what you really need is a simple object that represents the user, because the template references its members.
Just change the archive. (ID) for collection.Find-on (ID) and you're good to go!
Comments
Post a Comment