Skip to content

Commit

Permalink
docs(picker-legacy): update angular to standalone (#3951)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandyscarney authored Dec 30, 2024
1 parent 4fb2cd1 commit 04c2c28
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
```ts
import { Component } from '@angular/core';
import { PickerController } from '@ionic/angular';
import { IonButton, PickerController } from '@ionic/angular/standalone';

@Component({
selector: 'app-example',
templateUrl: 'example.component.html',
styleUrls: ['example.component.css'],
imports: [IonButton],
})
export class ExampleComponent {
constructor(private pickerCtrl: PickerController) {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
```ts
import { Component } from '@angular/core';
import { IonButton, IonPickerLegacy } from '@ionic/angular/standalone';

interface PickerValue {
languages: {
text: string;
value: string;
};
}

@Component({
selector: 'app-example',
templateUrl: 'example.component.html',
styleUrls: ['example.component.css'],
imports: [IonButton, IonPickerLegacy],
})
export class ExampleComponent {
isPickerOpen = false;
Expand Down Expand Up @@ -39,7 +49,7 @@ export class ExampleComponent {
},
{
text: 'Confirm',
handler: (value) => {
handler: (value: PickerValue) => {
console.log(`You selected: ${value.languages.value}`);
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
```ts
import { Component } from '@angular/core';
import { IonButton, IonPickerLegacy } from '@ionic/angular/standalone';

interface PickerValue {
languages: {
text: string;
value: string;
};
}

@Component({
selector: 'app-example',
templateUrl: 'example.component.html',
styleUrls: ['example.component.css'],
imports: [IonButton, IonPickerLegacy],
})
export class ExampleComponent {
public pickerColumns = [
Expand Down Expand Up @@ -37,7 +47,7 @@ export class ExampleComponent {
},
{
text: 'Confirm',
handler: (value) => {
handler: (value: PickerValue) => {
console.log(`You selected: ${value.languages.value}`);
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
```ts
import { Component } from '@angular/core';
import { IonButton, IonPickerLegacy } from '@ionic/angular/standalone';

interface PickerValue {
meat: {
text: string;
value: string;
};
veggies: {
text: string;
value: string;
};
crust: {
text: string;
value: string;
};
}

@Component({
selector: 'app-example',
templateUrl: 'example.component.html',
styleUrls: ['example.component.css'],
imports: [IonButton, IonPickerLegacy],
})
export class ExampleComponent {
public pickerColumns = [
Expand Down Expand Up @@ -67,7 +85,7 @@ export class ExampleComponent {
},
{
text: 'Confirm',
handler: (value) => {
handler: (value: PickerValue) => {
console.log(`You selected a ${value.crust.text} pizza with ${value.meat.text} and ${value.veggies.text}`);
},
},
Expand Down

0 comments on commit 04c2c28

Please sign in to comment.