Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
</ion-refresher>

<ion-list>
<ion-item [button]="true" *ngFor="let item of items">
@for (item of items; track item) {
<ion-item [button]="true">
<ion-icon slot="start" color="primary" [name]="item.unread ? 'ellipse' : ''"></ion-icon>
<ion-label>
<h2>{{ item.name }}</h2>
<p>New message from {{ item.name }}</p>
</ion-label>
</ion-item>
}
</ion-list>
</ion-content>
```
37 changes: 33 additions & 4 deletions static/usage/v7/refresher/advanced/angular/example_component_ts.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,42 @@
```ts
import { Component } from '@angular/core';
import {
IonContent,
IonHeader,
IonIcon,
IonItem,
IonLabel,
IonList,
IonRefresher,
IonRefresherContent,
IonTitle,
IonToolbar,
} from '@ionic/angular/standalone';

import { addIcons } from 'ionicons';
import { ellipse } from 'ionicons/icons';

interface Item {
name: string;
unread: boolean;
}

@Component({
selector: 'app-example',
templateUrl: 'example.component.html',
styleUrls: ['./example.component.css'],
imports: [
IonContent,
IonHeader,
IonIcon,
IonItem,
IonLabel,
IonList,
IonRefresher,
IonRefresherContent,
IonTitle,
IonToolbar,
],
})
export class ExampleComponent {
public names = [
Expand All @@ -25,7 +54,7 @@ export class ExampleComponent {
'Rachel Rabbit',
'Ted Turtle',
];
public items = [];
public items: Item[] = [];

constructor() {
/**
Expand All @@ -44,7 +73,7 @@ export class ExampleComponent {
return this.names[Math.floor(Math.random() * this.names.length)];
}

addItems(count, unread = false) {
addItems(count: number, unread = false) {
for (let i = 0; i < count; i++) {
this.items.unshift({
name: this.chooseRandomName(),
Expand All @@ -53,10 +82,10 @@ export class ExampleComponent {
}
}

handleRefresh(event) {
handleRefresh(event: CustomEvent) {
setTimeout(() => {
this.addItems(3, true);
event.target.complete();
(event.target as HTMLIonRefresherElement).complete();
}, 2000);
}
}
Expand Down
14 changes: 12 additions & 2 deletions static/usage/v7/refresher/basic/angular/example_component_ts.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
```ts
import { Component } from '@angular/core';
import {
IonContent,
IonHeader,
IonRefresher,
IonRefresherContent,
IonTitle,
IonToolbar,
} from '@ionic/angular/standalone';

@Component({
selector: 'app-example',
templateUrl: 'example.component.html',
styleUrls: ['example.component.css'],
imports: [IonContent, IonHeader, IonRefresher, IonRefresherContent, IonTitle, IonToolbar],
})
export class ExampleComponent {
handleRefresh(event) {
handleRefresh(event: CustomEvent) {
setTimeout(() => {
// Any calls to load data go here
event.target.complete();
(event.target as HTMLIonRefresherElement).complete();
}, 2000);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
```ts
import { Component } from '@angular/core';
import {
IonContent,
IonHeader,
IonRefresher,
IonRefresherContent,
IonTitle,
IonToolbar,
} from '@ionic/angular/standalone';

@Component({
selector: 'app-example',
templateUrl: 'example.component.html',
styleUrls: ['example.component.css'],
imports: [IonContent, IonHeader, IonRefresher, IonRefresherContent, IonTitle, IonToolbar],
})
export class ExampleComponent {
handleRefresh(event) {
handleRefresh(event: CustomEvent) {
setTimeout(() => {
// Any calls to load data go here
event.target.complete();
(event.target as HTMLIonRefresherElement).complete();
}, 2000);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
```ts
import { Component } from '@angular/core';
import {
IonContent,
IonHeader,
IonRefresher,
IonRefresherContent,
IonTitle,
IonToolbar,
} from '@ionic/angular/standalone';

@Component({
selector: 'app-example',
templateUrl: 'example.component.html',
styleUrls: ['example.component.css'],
imports: [IonContent, IonHeader, IonRefresher, IonRefresherContent, IonTitle, IonToolbar],
})
export class ExampleComponent {
handleRefresh(event) {
handleRefresh(event: CustomEvent) {
setTimeout(() => {
// Any calls to load data go here
event.target.complete();
(event.target as HTMLIonRefresherElement).complete();
}, 2000);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
```ts
import { Component } from '@angular/core';
import {
IonContent,
IonHeader,
IonRefresher,
IonRefresherContent,
IonTitle,
IonToolbar,
} from '@ionic/angular/standalone';

@Component({
selector: 'app-example',
templateUrl: 'example.component.html',
styleUrls: ['example.component.css'],
imports: [IonContent, IonHeader, IonRefresher, IonRefresherContent, IonTitle, IonToolbar],
})
export class ExampleComponent {
handleRefresh(event) {
handleRefresh(event: CustomEvent) {
setTimeout(() => {
// Any calls to load data go here
event.target.complete();
(event.target as HTMLIonRefresherElement).complete();
}, 2000);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
</ion-refresher>

<ion-list>
<ion-item [button]="true" *ngFor="let item of items">
@for (item of items; track item) {
<ion-item [button]="true">
<ion-icon slot="start" color="primary" [name]="item.unread ? 'ellipse' : ''"></ion-icon>
<ion-label>
<h2>{{ item.name }}</h2>
<p>New message from {{ item.name }}</p>
</ion-label>
</ion-item>
}
</ion-list>
</ion-content>
```
37 changes: 33 additions & 4 deletions static/usage/v8/refresher/advanced/angular/example_component_ts.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,42 @@
```ts
import { Component } from '@angular/core';
import {
IonContent,
IonHeader,
IonIcon,
IonItem,
IonLabel,
IonList,
IonRefresher,
IonRefresherContent,
IonTitle,
IonToolbar,
} from '@ionic/angular/standalone';

import { addIcons } from 'ionicons';
import { ellipse } from 'ionicons/icons';

interface Item {
name: string;
unread: boolean;
}

@Component({
selector: 'app-example',
templateUrl: 'example.component.html',
styleUrls: ['./example.component.css'],
imports: [
IonContent,
IonHeader,
IonIcon,
IonItem,
IonLabel,
IonList,
IonRefresher,
IonRefresherContent,
IonTitle,
IonToolbar,
],
})
export class ExampleComponent {
public names = [
Expand All @@ -25,7 +54,7 @@ export class ExampleComponent {
'Rachel Rabbit',
'Ted Turtle',
];
public items = [];
public items: Item[] = [];

constructor() {
/**
Expand All @@ -44,7 +73,7 @@ export class ExampleComponent {
return this.names[Math.floor(Math.random() * this.names.length)];
}

addItems(count, unread = false) {
addItems(count: number, unread = false) {
for (let i = 0; i < count; i++) {
this.items.unshift({
name: this.chooseRandomName(),
Expand All @@ -53,10 +82,10 @@ export class ExampleComponent {
}
}

handleRefresh(event) {
handleRefresh(event: CustomEvent) {
setTimeout(() => {
this.addItems(3, true);
event.target.complete();
(event.target as HTMLIonRefresherElement).complete();
}, 2000);
}
}
Expand Down
14 changes: 12 additions & 2 deletions static/usage/v8/refresher/basic/angular/example_component_ts.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
```ts
import { Component } from '@angular/core';
import {
IonContent,
IonHeader,
IonRefresher,
IonRefresherContent,
IonTitle,
IonToolbar,
} from '@ionic/angular/standalone';

@Component({
selector: 'app-example',
templateUrl: 'example.component.html',
styleUrls: ['example.component.css'],
imports: [IonContent, IonHeader, IonRefresher, IonRefresherContent, IonTitle, IonToolbar],
})
export class ExampleComponent {
handleRefresh(event) {
handleRefresh(event: CustomEvent) {
setTimeout(() => {
// Any calls to load data go here
event.target.complete();
(event.target as HTMLIonRefresherElement).complete();
}, 2000);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
```ts
import { Component } from '@angular/core';
import {
IonContent,
IonHeader,
IonRefresher,
IonRefresherContent,
IonTitle,
IonToolbar,
} from '@ionic/angular/standalone';

@Component({
selector: 'app-example',
templateUrl: 'example.component.html',
styleUrls: ['example.component.css'],
imports: [IonContent, IonHeader, IonRefresher, IonRefresherContent, IonTitle, IonToolbar],
})
export class ExampleComponent {
handleRefresh(event) {
handleRefresh(event: CustomEvent) {
setTimeout(() => {
// Any calls to load data go here
event.target.complete();
(event.target as HTMLIonRefresherElement).complete();
}, 2000);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
```ts
import { Component } from '@angular/core';
import {
IonContent,
IonHeader,
IonRefresher,
IonRefresherContent,
IonTitle,
IonToolbar,
} from '@ionic/angular/standalone';

@Component({
selector: 'app-example',
templateUrl: 'example.component.html',
styleUrls: ['example.component.css'],
imports: [IonContent, IonHeader, IonRefresher, IonRefresherContent, IonTitle, IonToolbar],
})
export class ExampleComponent {
handleRefresh(event) {
handleRefresh(event: CustomEvent) {
setTimeout(() => {
// Any calls to load data go here
event.target.complete();
(event.target as HTMLIonRefresherElement).complete();
}, 2000);
}
}
Expand Down
Loading