forked from OnsenUI/playground
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpull-hook.html
More file actions
92 lines (76 loc) · 2 KB
/
Copy pathpull-hook.html
File metadata and controls
92 lines (76 loc) · 2 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Onsen UI App</title>
<script type="text/typescript">
import {
Component,
OnsenModule,
NgModule,
CUSTOM_ELEMENTS_SCHEMA
} from 'angular2-onsenui';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {BrowserModule} from '@angular/platform-browser';
@Component({
selector: 'app',
template: `
<ons-page>
<ons-toolbar>
<div class="center">Pull Hook</div>
</ons-toolbar>
<div class="content">
<ons-pull-hook height="64px" threshold-height="128px" (changestate)="onChangeState($event)" (action)="onAction($event)">
{{message}}
</ons-pull-hook>
<ons-list>
<ons-list-item *ngFor="let item of items; let i = index">Item {{i}}</ons-list-item>
</ons-list>
</div>
</ons-page>
`
})
export class AppComponent {
message: string = 'Pull down to refresh';
items: number[] = [1, 2, 3, 4, 5];
constructor() {
}
onAction($event) {
setTimeout(() => {
$event.done();
this.items.push(0);
}, 1000);
}
onChangeState($event) {
switch ($event.state) {
case 'initial':
this.message = 'Pull down to refresh';
break;
case 'preaction':
this.message = 'Release to refresh';
break;
case 'action':
this.message = 'Loading data...';
break;
}
}
}
@NgModule({
imports: [OnsenModule, BrowserModule],
declarations: [AppComponent],
bootstrap: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
class AppModule { }
platformBrowserDynamic().bootstrapModule(AppModule);
</script>
</head>
<body>
<app></app>
</body>
</html>
<!-- info
## Pull Hook
Pull hook is made using `OnsPullHook` directive. Please see [OnsPullHook Reference](https://onsen.io/v2/docs/angular2/ons-pull-hook.html) for more details.
Tutorial contents will be added soon.
-->