Installation
import { WrPullToRefresh } from 'ngwr/pull-to-refresh';
@Component({ imports: [WrPullToRefresh] })
export class MyComponent {}Basic
Pull down from the very top on a touch device and release past the threshold to fire refresh; a light haptic tap marks the arming point. It's a controlled spinner — bind refreshing and clear it when the work settles. No touch device handy? The button drives the same refreshing state programmatically.
<wr-pull-to-refresh
style="height: 16rem"
[refreshing]="loading()"
(refresh)="reload()"
>
@for (item of items(); track item) {
<div class="row">{{ item }}</div>
}
</wr-pull-to-refresh>protected readonly loading = signal(false);
reload(): void {
this.loading.set(true);
this.api.fetch().subscribe((rows) => {
this.items.set(rows);
this.loading.set(false); // clearing `refreshing` closes the indicator
});
}API
| Name | Description | Type | Default |
|---|---|---|---|
refreshing | Whether a refresh is in flight — drives the spinner. Set true in refresh, false when it resolves. | boolean | false |
threshold | Pull distance (px) a release must reach to trigger. | number | 64 |
disabled | Disable the gesture entirely. | boolean | false |
(refresh) | Fires when the user pulls past threshold and releases. | void | — |