File tree Expand file tree Collapse file tree 3 files changed +15
-32
lines changed
app/ui-category/switch/disable-switch Expand file tree Collapse file tree 3 files changed +15
-32
lines changed Original file line number Diff line number Diff line change 1- Set ` Switch ` in ` HTML ` code
2- <snippet id =' switch-view-html ' />
3-
4- Disable ` Switch ` control via setting ` isEnable ` property to false
5- <snippet id =' disable-switch-code ' />
1+ Set ` Switch ` in ` HTML ` code.
2+ Disable ` Switch ` control via setting ` isEnabled ` property to false.
3+ <snippet id =' disable-switch ' />
Original file line number Diff line number Diff line change 11< StackLayout sdkExampleTitle sdkToggleNavButton >
22 < StackLayout class ="example-container ">
3- <!-- >> switch-view-html -->
4- < GridLayout rows ="auto auto auto auto " columns ="* * " class ="m-5 ">
5- < Label class ="h3 m-15 " [text] ="sw1.isEnabled ? 'enabled' : 'disabled' " textWrap ="true " row ="0 " col ="0 "> </ Label >
6- < Switch class ="m-15 " #sw1 checked ="true " row ="0 " col ="1 "> </ Switch >
7- < Label class ="h3 m-15 " [text] ="sw2.isEnabled ? 'enabled' : 'disabled' " textWrap ="true " row ="1 " col ="0 "> </ Label >
8- < Switch class ="m-15 " #sw2 checked ="false " row ="1 " col ="1 "> </ Switch >
9- < Label class ="h3 m-15 " [text] ="sw3.isEnabled ? 'enabled' : 'disabled' " textWrap ="true " row ="2 " col ="0 "> </ Label >
10- < Switch class ="m-15 " #sw3 checked ="true " row ="2 " col ="1 "> </ Switch >
11- < Button class ="btn btn-primary btn-active " text ="Disable switches " (tap) ="onTap() " row ="3 " col ="0 " colSpan ="2 " horizontalAlignment ="stretch "> </ Button >
3+ <!-- >> disable-switch -->
4+ < GridLayout rows ="auto auto " columns ="* * " class ="m-5 ">
5+ < Label class ="h3 m-15 "
6+ [text] ="switch.isEnabled ? 'enabled' : 'disabled' "
7+ textWrap ="true " row ="0 " col ="0 "> </ Label >
8+ < Switch #switch class ="m-15 " row ="0 " col ="1 "> </ Switch >
9+
10+ < Button class ="btn btn-primary btn-active "
11+ [text] ="switch.isEnabled ? 'Disable switch' : 'Enable switch' "
12+ (tap) ="switch.isEnabled = !switch.isEnabled "
13+ row ="3 " col ="0 " colSpan ="2 " horizontalAlignment ="stretch "> </ Button >
1214 </ GridLayout >
13- <!-- << switch-view-html -->
15+ <!-- << disable-switch -->
1416 </ StackLayout >
1517</ StackLayout >
Original file line number Diff line number Diff line change 1- // >> disable-switch-code
21import { Component , ViewChild , ElementRef } from "@angular/core" ;
32import { Switch } from "ui/switch" ;
43
@@ -8,20 +7,4 @@ import { Switch } from "ui/switch";
87 styleUrls : [ "./../switch.style.css" ] ,
98} )
109export class DisableSwitchComponent {
11-
12- @ViewChild ( "sw1" ) firstSwitch : ElementRef ;
13- @ViewChild ( "sw2" ) secondSwitch : ElementRef ;
14- @ViewChild ( "sw3" ) thirdSwitch : ElementRef ;
15-
16- public onTap ( ) {
17- let firstsw : Switch = < Switch > this . firstSwitch . nativeElement ;
18- let secondsw : Switch = < Switch > this . secondSwitch . nativeElement ;
19- let thirdsw : Switch = < Switch > this . thirdSwitch . nativeElement ;
20-
21- firstsw . isEnabled = false ;
22- secondsw . isEnabled = false ;
23- thirdsw . isEnabled = false ;
24- }
25-
2610}
27- // << disable-switch-code
You can’t perform that action at this time.
0 commit comments