Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. export class PhotosComponent implements OnInit {
  2. public photos:any[]
  3. constructor(){}
  4. ngOnInit(){
  5.  
  6. S3.listObjects({Delimiter: '/'}, function(err, data) {
  7.  
  8. var albumName
  9. if (err) {
  10. return alert('There was an error listing your albums: ' + err.message);
  11. } else {
  12. console.log(data.CommonPrefixes)
  13.  
  14. var albums = data.CommonPrefixes.map(function(commonPrefix) {
  15. // console.log(albums)
  16. var prefix = commonPrefix.Prefix;
  17. console.log(prefix)
  18. albumName = decodeURIComponent(prefix.replace('/', ''));
  19. console.log(albumName)
  20. this.photos.push(albumName)
  21. });
  22.  
  23. }
  24.  
  25.  
  26. });
  27. console.log(this.photos)
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement