tweet-body.ts 842 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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()
  14. data: any[];
  15. constructor() {}
  16. get status(): string {
  17. if (this.data["retweeted_status"]) {
  18. return this.data["retweeted_status"]["full_text"];
  19. } else {
  20. return this.data["full_text"];
  21. }
  22. }
  23. get entities() {
  24. if (this.data["retweeted_status"]) {
  25. return this.data["retweeted_status"]["entities"];
  26. } else {
  27. return this.data["entities"];
  28. }
  29. }
  30. get hasPhoto() {
  31. return (
  32. this.entities["media"] && this.entities["media"][0]["type"] == "photo"
  33. );
  34. }
  35. }