This repository has been archived by the owner on Feb 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mdCheckbox): support two-way binding to checked property
- add basic switch usage to examples
- Loading branch information
1 parent
96422ad
commit d220c42
Showing
4 changed files
with
49 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<div class="inset"> | ||
<md-switch [(checked)]="data.cb1" aria-label="Switch 1"> | ||
Switch 1: {{ data.cb1 }} | ||
</md-switch> | ||
<md-switch [(checked)]="data.cb2" aria-label="Switch 2" ng-true-value="'yup'" ng-false-value="'nope'" class="md-warn"> | ||
Switch 2 (md-warn): {{ data.cb2 }} | ||
</md-switch> | ||
<md-switch disabled="true" aria-label="Disabled switch" [(checked)]="disabledModel"> | ||
Switch (Disabled) | ||
</md-switch> | ||
<md-switch disabled="true" aria-label="Disabled active switch" [(checked)]="data.cb4"> | ||
Switch (Disabled, Active) | ||
</md-switch> | ||
<md-switch class="md-primary" md-no-ink aria-label="Switch No Ink" [(checked)]="data.cb5"> | ||
Switch (md-primary): No Ink | ||
</md-switch> | ||
<md-switch [checked]="data.cb6" aria-label="Switch 6" (checkedChange)="onChange($event)"> | ||
Switch 6 message: {{ message }} | ||
</md-switch> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import {View, Component} from 'angular2/core'; | ||
import {MATERIAL_DIRECTIVES} from '../../base'; | ||
|
||
@Component({selector: 'switch-basic-usage'}) | ||
@View({templateUrl: 'examples/components/switch/basic_usage.html', directives: [MATERIAL_DIRECTIVES]}) | ||
export default class SwitchBasicUsage { | ||
public data: any = { | ||
cb1: true, | ||
cb4: true, | ||
cb5: false | ||
}; | ||
public message = 'false'; | ||
|
||
public onChange(cbState) { | ||
this.message = cbState; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters