docs(accordion): add usage on how to get and set the state programmatically (#23595)

This commit is contained in:
Liam DeBeasi
2021-07-08 16:47:21 -04:00
committed by GitHub
parent 259b1359db
commit 1c9435c3f5
8 changed files with 1248 additions and 487 deletions

View File

@@ -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() {