-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Showing current user in Meteor #173
Comments
Might be a load order issue. Your Blade document is probably rendering before |
This issue is documented here: https://github.com/bminer/node-blade/wiki/Using-Blade-with-Meteor#troubleshooting-and-known-issues If that doesn't solve it, please feel free to post back here. |
Yeah, still a problem. I tried moving if Meteor.isClient
Meteor.startup ->
Template.body.user = ->
if Meteor.users()
if ! Meteor.loggingIn()
return Meteor.users().username to a directory called "zCode" inside my root app folder. My view in question is #container
.container
header.main-header
a.nav-link.root(href="/") root
a.nav-link(href="/login") #{user} I even tried putting the If I try - if (#{user})
a.user #{user} I get Meteor terminal errors originating from Blade. I've also tried And just for clarity, yes, I currently have a user logged in. I get a result with: Meteor.users() in the console once the page is loaded. If I remove the |
Hmmm...
... is invalid syntax, so that definitely won't work. Try using Also, if it still doesn't work, could you copy/paste the HTML source code for your Meteor app? Or, can you provide the URL for your project? |
If I try
Also tried renaming the helper to avoid namespace issues to no avail. The URL to my app (with the #{user} calls removed from the view) is http://hacker.meteor.com/landing The repo is here: https://github.com/Polyrhythm/hacker |
That means that your helper is working. The problem is here: if Meteor.isClient
Meteor.startup ->
Template.body.user = ->
if Meteor.users()
if ! Meteor.loggingIn()
return Meteor.users().username # <------------- problem: Property `users` is not a function But, yeah... your problem before was a startup issue that will be fixed once the Meteor guys fix this bug: meteor/meteor#181 Basically, right now you are required to put In your case, though, you are using Angular to load views depending on the URL, I presume. The problem occurs when you call Fix your view helper first... the whole "users is not a function" thing. Then, move the following code to the bottom of
Hope that helps! |
Closing this issue for now, but please feel free to post back here. Thanks! |
** UPDATE ** Hold up on using up your time on this. I may be on to something to fix...Original issue text below: I'm still having all kinds of problems. :( If I wrap the Angular bootstrap inside of the If you think this is actually an issue with the Angular smart package I'm using (https://github.com/olanod/ng-meteor) then I can bring them into the conversation. I should add that, of course, this doesn't appear to pick up a logged-in user if I keep the Angular stuff out of the As a side note, check out the console on sign in or logging in - lots of what looks like repetitive activity. Not sure if that's a normal Meteor thing or an effect of me loading the DOM twice. Thanks for the help thus far in any case. |
Yeah I can't get this to play nicely with Angular. Either your blade templates load the user fine without Angular, or I use Angular and end up generating two versions of the DOM. |
Again, this is more of a Meteor issue than anything else, I believe. The Blade smart package cannot enforce the load order of files, and therefore, it cannot ensure that the templates are loaded before anything else. I'm hoping that bugs like this get cleaned up in the next few weeks. |
I can't for the life of me get this to work. Here's some JS I have in the client for Meteor:
How do I have my Blade template checking for the existence for user? I tried
#{user}
but I get errors that user is not defined yet. If I check for the existence for a user withI get an error. Not really sure how to get the template to return a current user without just spitting it back before the user is loaded from Meteor.
The text was updated successfully, but these errors were encountered: