Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. //JS file
  2. Meteor.users.insert({
  3. username: 'admin',
  4. profile: {
  5. first_name: 'Clark',
  6. last_name: 'Kent'
  7. },
  8.  
  9. });
  10.  
  11. // HTML view
  12. {{Meteor.user().username}}
  13. {{Meteor.user().profile.first_name}}
  14. {{Meteor.user().profile.last_name}}
  15.  
  16. <template name="user">
  17. <p>{{firstName}}</p>
  18. </template>
  19.  
  20. Template.user.helpers({
  21. firstName: function() {
  22. return Meteor.user().profile.first_name;
  23. }
  24. });
  25.  
  26. {{#if currentUser}}
  27. {{> user}}
  28. {{/if}}
  29.  
  30. {{#with currentUser}}
  31. {{#with profile}}
  32. {{first_name}}
  33. {{/with}}
  34. {{/with}}
  35.  
  36. {{#with userDetails}}
  37. First name:-{{this.first_name}}
  38. Last name:- {{this.last_name}}
  39. {{/with}}
  40.  
  41. //jsSide
  42. userDetails(){
  43. return Meteor.user();
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement