Skip to content

docs(picker-legacy): update angular to standalone #3951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 30, 2024
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