/
feed.ts
40 lines (34 loc) · 1.06 KB
/
feed.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy } from '@angular/core';
import { InfiniteScroll, Refresher } from 'ionic-angular';
import { ITweet } from './../../reducers';
/**
* Generated class for the FeedComponent component.
*
* See https://angular.io/docs/ts/latest/api/core/index/ComponentMetadata-class.html
* for more info on Angular Components.
*/
@Component({
selector: 'feed',
templateUrl: 'feed.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class FeedComponent {
@Input() content: ITweet[];
@Input() isFetching: boolean;
@Output() onInit: EventEmitter<any> = new EventEmitter<any>();
@Output() onInfinite: EventEmitter<any> = new EventEmitter<any>();
@Output() onRefresh: EventEmitter<any> = new EventEmitter<any>();
constructor() {}
ngOnInit() {
this.onInit.emit();
}
doRefresh(refresher: Refresher) {
this.onRefresh.emit(refresher);
}
doInfinite(infiniteScroll: InfiniteScroll) {
this.onInfinite.emit(infiniteScroll);
}
trackById(index, item) {
return item.id_str;
}
}