Advertisement
Guest User

Untitled

a guest
Jan 26th, 2015
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. function (BlockResource) {
  2. var collection;
  3.  
  4. this.init = function () {
  5. collection = BlockResource.get().$promise;
  6. };
  7.  
  8. this.getBlock = function (id) {
  9. if (!collection) {
  10. this.init();
  11. }
  12. return collection.then(function (blocks) {
  13. return blocks.filter(function (block) {
  14. return block.id = id;
  15. });
  16. });
  17. };
  18. this.getBlocks = function () {
  19. if (!collection) {
  20. this.init();
  21. }
  22. return collection;
  23. };
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement