search-results-users.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import { Component } from "@angular/core";
  2. import {
  3. IonicPage,
  4. NavController,
  5. NavParams,
  6. Refresher,
  7. InfiniteScroll,
  8. App,
  9. Events
  10. } from "ionic-angular";
  11. import { ProfilePage } from "../profile/profile";
  12. @IonicPage()
  13. @Component({
  14. selector: "page-search-results-users",
  15. templateUrl: "search-results-users.html"
  16. })
  17. export class SearchResultsUsersPage {
  18. query: string;
  19. nextPage: number = 2;
  20. users: any[] = [];
  21. constructor(
  22. public navCtrl: NavController,
  23. public navParams: NavParams,
  24. private appCtrl: App,
  25. private events: Events
  26. ) {
  27. this.query = this.navParams.data;
  28. this.events.subscribe("query:changed", query => {
  29. if (query.length) {
  30. // this.twitter.searchUsers(query).then(res => (this.users = res));
  31. // this.query = query;
  32. }
  33. });
  34. }
  35. async ionViewDidLoad() {
  36. if (this.query.length) {
  37. // this.users = await this.twitter.searchUsers(this.query);
  38. }
  39. }
  40. showProfile(userId) {
  41. this.appCtrl.getRootNav().push(ProfilePage, { userId });
  42. this.nextPage = 2;
  43. }
  44. doRefresh(refresher: Refresher) {
  45. // this.twitter.searchUsers(this.query).then(users => {
  46. // this.users = users;
  47. // this.nextPage = 2;
  48. // refresher.complete();
  49. // });
  50. }
  51. loadMore(infiniteScroll: InfiniteScroll) {
  52. // this.twitter.searchUsers(this.query, this.nextPage).then(users => {
  53. // this.users = this.users.concat(users);
  54. // infiniteScroll.complete();
  55. // this.nextPage = this.nextPage + 1;
  56. // });
  57. }
  58. }