tweet.ts 751 B

1234567891011121314151617181920212223242526272829303132333435
  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. console.log('inside tweet.html tihs.data is:', this.data);
  18. if (this.data["retweeted_status"]) {
  19. return this.data["retweeted_status"]["user"];
  20. } else {
  21. return this.data["user"];
  22. }
  23. }
  24. get createdAt() {
  25. if (this.data["retweeted_status"]) {
  26. return this.data["retweeted_status"]["created_at"];
  27. } else {
  28. return this.data["created_at"];
  29. }
  30. }
  31. }