mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
docs(accordion): add usage on how to get and set the state programmatically (#23595)
This commit is contained in:
@@ -31,14 +31,6 @@
|
||||
<div slot="title">My Custom Title</div>
|
||||
</ion-datetime>
|
||||
|
||||
<!-- Custom buttons -->
|
||||
<ion-datetime #customDatetime>
|
||||
<ion-buttons slot="buttons">
|
||||
<ion-button (click)="confirm()">Good to go!</ion-button>
|
||||
<ion-button (click)="reset()">Reset</ion-button>
|
||||
</ion-buttons>
|
||||
</ion-datetime>
|
||||
|
||||
<!-- Datetime in overlay -->
|
||||
<ion-button id="open-modal">Open Datetime Modal</ion-button>
|
||||
<ion-modal trigger="open-modal">
|
||||
@@ -48,11 +40,28 @@
|
||||
</ion-content>
|
||||
</ng-template>
|
||||
</ion-modal>
|
||||
```
|
||||
|
||||
**component.html**
|
||||
```html
|
||||
<!-- Custom buttons -->
|
||||
<ion-datetime>
|
||||
<ion-buttons slot="buttons">
|
||||
<ion-button (click)="confirm()">Good to go!</ion-button>
|
||||
<ion-button (click)="reset()">Reset</ion-button>
|
||||
</ion-buttons>
|
||||
</ion-datetime>
|
||||
```
|
||||
|
||||
**component.ts**
|
||||
```typescript
|
||||
|
||||
import { Component, ViewChild } from '@angular/core';
|
||||
import { IonDatetime } from '@ionic/angular';
|
||||
|
||||
```javascript
|
||||
@Component({…})
|
||||
export class MyComponent {
|
||||
@ViewChild('customDatetime', { static: false }) datetime: HTMLIonDateTimeElement;
|
||||
@ViewChild(IonDatetime, { static: true }) datetime: IonDatetime;
|
||||
constructor() {}
|
||||
|
||||
confirm() {
|
||||
|
||||
Reference in New Issue
Block a user