tweet.ts 688 B

12345678910111213141516171819202122232425262728293031323334
  1. import { Component, Input } from "@angular/core";
  2. /**
  3. * Generated class for the TweetComponent component.
  4. *
  5. * See https://angular.io/api/core/Component for more info on Angular
  6. * Components.
  7. */
  8. @Component({
  9. selector: "tweet",
  10. templateUrl: "tweet.html"
  11. })
  12. export class TweetComponent {
  13. @Input()
  14. data: any[];
  15. constructor() {}
  16. get user() {
  17. if (this.data["retweeted_status"]) {
  18. return this.data["retweeted_status"]["user"];
  19. } else {
  20. return this.data["user"];
  21. }
  22. }
  23. get createdAt() {
  24. if (this.data["retweeted_status"]) {
  25. return this.data["retweeted_status"]["created_at"];
  26. } else {
  27. return this.data["created_at"];
  28. }
  29. }
  30. }