Meteor.user() is undefined in Meteor version 1.5

I am new to meteor. and I am trying to display some user information on webpage and here is the html:

        <div>
            <span id="login-entrance">{{loginEntranceContent}}</span>
        </div>

Here is the client side js:


Template.body.helpers({
    loginEntranceContent(){
        if (Meteor.userId()==null) {
            return 'Log in/Sign up';
        } else {
                Meteor.user().emails.address;
        };
    },
});

While the Meteor.userId() worked(I can get the value of _Id of the user) but the Meteor.user() returned undefined(and it didn’t refresh it). And I know it must be the problem of DOM rendered before data was ready. I thought the data binding and update was automatically accomplished. how did it happen?

I have go round in meteor forum and stackoverflow forum. there are some similar topics but none of them have provide clear explain and simple solution.
All I want is to display the current login user information. Can anyone give me any clue?

Check the structure of Meteor.users(), emails is actually an array. You need to do the following (but should probably check if the emails array actually has elements in it)

Template.body.helpers({
    loginEntranceContent(){
        if (Meteor.userId()==null) {
            return 'Log in/Sign up';
        } else {
                Meteor.user().emails[0].address;
        };
    },
});

you are right about it. I checked the guide and found this issue. Thanks alot