|
| 1 | +/** |
| 2 | + * @license |
| 3 | + * Copyright Google LLC All Rights Reserved. |
| 4 | + * |
| 5 | + * Use of this source code is governed by an MIT-style license that can be |
| 6 | + * found in the LICENSE file at https://angular.io/license |
| 7 | + */ |
| 8 | + |
| 9 | +import {Component, NgModule, ViewEncapsulation} from '@angular/core'; |
| 10 | +import {BrowserModule} from '@angular/platform-browser'; |
| 11 | +import {MatRadioModule} from '@angular/material-experimental/mdc-radio'; |
| 12 | + |
| 13 | +/** component: mdc-radio-button */ |
| 14 | + |
| 15 | +@Component({ |
| 16 | + selector: 'app-root', |
| 17 | + template: ` |
| 18 | + <button id="show-two" (click)="showTwo()">Show Two</button> |
| 19 | + <button id="hide-two" (click)="hideTwo()">Hide Two</button> |
| 20 | +
|
| 21 | + <button id="show-ten" (click)="showTen()">Show Ten</button> |
| 22 | + <button id="hide-ten" (click)="hideTen()">Hide Ten</button> |
| 23 | +
|
| 24 | + <mat-radio-group aria-label="Select an option" *ngIf="isTwoVisible"> |
| 25 | + <mat-radio-button value="1" id="btn-1">Option 1</mat-radio-button> |
| 26 | + <mat-radio-button value="2" id="btn-2">Option 2</mat-radio-button> |
| 27 | + </mat-radio-group> |
| 28 | +
|
| 29 | + <mat-radio-group aria-label="Select an option" *ngIf="isTenVisible"> |
| 30 | + <mat-radio-button value="1">Option 1</mat-radio-button> |
| 31 | + <mat-radio-button value="2">Option 2</mat-radio-button> |
| 32 | + <mat-radio-button value="3">Option 3</mat-radio-button> |
| 33 | + <mat-radio-button value="4">Option 4</mat-radio-button> |
| 34 | + <mat-radio-button value="5">Option 5</mat-radio-button> |
| 35 | + <mat-radio-button value="6">Option 6</mat-radio-button> |
| 36 | + <mat-radio-button value="7">Option 7</mat-radio-button> |
| 37 | + <mat-radio-button value="8">Option 8</mat-radio-button> |
| 38 | + <mat-radio-button value="9">Option 9</mat-radio-button> |
| 39 | + <mat-radio-button value="10">Option 10</mat-radio-button> |
| 40 | + </mat-radio-group> |
| 41 | + `, |
| 42 | + encapsulation: ViewEncapsulation.None, |
| 43 | + styleUrls: ['//src/material-experimental/mdc-theming/prebuilt/indigo-pink.css'], |
| 44 | +}) |
| 45 | +export class RadioBenchmarkApp { |
| 46 | + isTwoVisible = false; |
| 47 | + isTenVisible = false; |
| 48 | + |
| 49 | + showTwo() { this.isTwoVisible = true; } |
| 50 | + hideTwo() { this.isTwoVisible = false; } |
| 51 | + |
| 52 | + showTen() { this.isTenVisible = true; } |
| 53 | + hideTen() { this.isTenVisible = false; } |
| 54 | +} |
| 55 | + |
| 56 | + |
| 57 | +@NgModule({ |
| 58 | + declarations: [RadioBenchmarkApp], |
| 59 | + imports: [ |
| 60 | + BrowserModule, |
| 61 | + MatRadioModule, |
| 62 | + ], |
| 63 | + bootstrap: [RadioBenchmarkApp], |
| 64 | +}) |
| 65 | +export class AppModule {} |
0 commit comments