forked from ionic-team/ionic-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrefresher-content.ts
More file actions
69 lines (59 loc) · 1.88 KB
/
Copy pathrefresher-content.ts
File metadata and controls
69 lines (59 loc) · 1.88 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import {Component, Input} from 'angular2/core'
import {NgIf} from 'angular2/common';
import {Config} from '../../config/config';
import {Icon} from '../icon/icon';
import {Refresher} from './refresher';
import {Spinner} from '../spinner/spinner';
/**
* @private
*/
@Component({
selector: 'ion-refresher-content',
template:
'<div class="refresher-pulling">' +
'<div class="refresher-pulling-icon" *ngIf="pullingIcon">' +
'<ion-icon [name]="pullingIcon"></ion-icon>' +
'</div>' +
'<div class="refresher-pulling-text" [innerHTML]="pullingText" *ngIf="pullingText"></div>' +
'</div>' +
'<div class="refresher-refreshing">' +
'<div class="refresher-refreshing-icon">' +
'<ion-spinner [name]="refreshingSpinner"></ion-spinner>' +
'</div>' +
'<div class="refresher-refreshing-text" [innerHTML]="refreshingText" *ngIf="refreshingText"></div>' +
'</div>',
directives: [NgIf, Icon, Spinner],
host: {
'[attr.state]': 'r.state'
}
})
export class RefresherContent {
/**
* @input {string} a static icon to display when you begin to pull down
*/
@Input() pullingIcon: string;
/**
* @input {string} the text you want to display when you begin to pull down
*/
@Input() pullingText: string;
/**
* @input {string} An animated SVG spinner that shows when refreshing begins
*/
@Input() refreshingSpinner: string;
/**
* @input {string} the text you want to display when performing a refresh
*/
@Input() refreshingText: string;
constructor(private r: Refresher, private _config: Config) {}
/**
* @private
*/
ngOnInit() {
if (!this.pullingIcon) {
this.pullingIcon = this._config.get('refresherPullingIcon', 'arrow-down');
}
if (!this.refreshingSpinner) {
this.refreshingSpinner = this._config.get('refresherRefreshingSpinner', this._config.get('spinner', 'ios'));
}
}
}