tweet-body.ts 825 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { Component, Input } from '@angular/core';
  2. /**
  3. * Generated class for the TweetBodyComponent component.
  4. *
  5. * See https://angular.io/api/core/Component for more info on Angular
  6. * Components.
  7. */
  8. @Component({
  9. selector: 'tweet-body',
  10. templateUrl: 'tweet-body.html'
  11. })
  12. export class TweetBodyComponent {
  13. @Input() data: any[];
  14. constructor() {}
  15. get status(): string {
  16. if(this.data["retweeted_status"]) {
  17. return this.data["retweeted_status"]["full_text"];
  18. } else {
  19. return this.data["full_text"];
  20. }
  21. }
  22. get entities(){
  23. if(this.data["retweeted_status"]) {
  24. return this.data["retweeted_status"]["entities"];
  25. } else {
  26. return this.data["entities"];
  27. }
  28. }
  29. get hasPhoto() {
  30. return this.entities["media"] && this.entities["media"][0]["type"] == 'photo';
  31. }
  32. }