Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. his.dataProvider.getProducts().subscribe((products) => {
  2. this.products = products;
  3.  
  4. //Pull an Array of ASINs from Firebase Database
  5. this.products.forEach(product => {
  6. this.asins.push(product.ASIN)
  7.  
  8. this.productKey.push(product.$key)
  9. //console.log(this.productKey.toString());
  10. var lastASIN = this.productKey.pop();
  11. console.log (lastASIN);
  12.  
  13. return this.dataProvider.getNextProducts(lastASIN).subscribe((products) => {
  14. this.products.forEach(product => {
  15. this.asins.push(product.ASIN)
  16. this.productKey.push(product.$key)
  17. var newASIN = this.productKey.pop();
  18. console.log (newASIN);
  19. })
  20. })
  21.  
  22. });
  23.  
  24. import 'rxjs/add/operator/take';
  25. import 'rxjs/add/operator/skip';
  26.  
  27. this.dataProvider.getNextProducts(lastASIN).skip(numToSkip).take(10).subscribe(...
  28.  
  29. new Firebase("https://examples-sql-queries.firebaseio.com/widget")
  30. .startAt(null, lastWidgetOnPrevPage)
  31. .limitToFirst(LIMIT+1) // add one to limit to account for lastWidgetOnPrevPage
  32. .once('value', function(snap) {
  33. var vals = snap.val()||{};
  34. delete vals[lastWidgetOnPrevPage]; // delete the extraneous record
  35. console.log('widgets on this page', vals);
  36. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement