Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. {
  2. "books" : {
  3. "-KfwYdQClUK9ivglf-Jq" : {
  4. "-KfwYdQClUK9ivglf-Jr" : {
  5. "author" : "Rand",
  6. "description" : "something",
  7. "id" : "-KfwYdQClUK9ivglf-Jq",
  8. "title" : "sometitle"
  9. }
  10. },
  11. "-Kfly2F4T_ORCra5e01W" : {
  12. "-Kfly2F4T_ORCra5e01X" : {
  13. "author" : "Rand",
  14. "description" : "something",
  15. "id" : "-KfwYdQClUK9ivglf-Jq",
  16. "title" : "sometitle"
  17. }
  18. }
  19. }
  20.  
  21. var booksController = function () {
  22. function all(context) {
  23. templates.get('books')
  24. .then(function (template) {
  25. var data = [];
  26.  
  27. var booksRef = firebase.database().ref('books');
  28. booksRef.on('value', function (snapshot) {
  29. var a = snapshot.val();
  30. data.push(a);
  31. context.$element().html(template(data));
  32. });
  33. });
  34. }
  35.  
  36. <ul>
  37. {{#each this}}
  38. {{#each this}}
  39. {{#each this}}
  40. <li>
  41. <p id="{{id}}">Author: {{author}}</p>
  42. <p>Title: {{title}}</p>
  43. </li>
  44. {{/each}}
  45. {{/each}}
  46. {{/each}}
  47. </ul>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement