Skip to content

Commit 8c1c975

Browse files
Merge pull request #1 from EddyVerbruggen/radiobuttons
Radiobuttons
2 parents da6d35a + 5e5ac05 commit 8c1c975

File tree

11 files changed

+683
-527
lines changed

11 files changed

+683
-527
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export class SomeComponent {
8888
<StackLayout>
8989
<CheckBox #CB1 text="CheckBox Label" checked="false"></CheckBox>
9090
<Button (tap)="toggleCheck()" text="Toggle it!"></Button>
91-
<Button (tap)="getCheckProp()" text="Check Property"></
91+
<Button (tap)="getCheckProp()" text="Check Property"></Button>
9292
</StackLayout>
9393
```
9494

@@ -98,6 +98,10 @@ export class SomeComponent {
9898
- **text** - text to use with the checkbox
9999
- **fillColor** - Color of the checkbox element
100100

101+
## Events
102+
103+
- **checkedChange** - Use a reference to the CheckBox component to grab it's `checked` property when this event fires to see the new value.
104+
101105
## API
102106

103107
- **toggle()** - Change the checked state of the view to the inverse of its current state.
@@ -124,6 +128,12 @@ Add the following to `app/App_Resources/Android/drawable/checkbox_grey.xml`
124128
</selector>
125129
```
126130

131+
## Radiobuttons, anyone?
132+
Want to use radiobutton behavior for your checkboxes (only one option possible within a group)?
133+
134+
Check out the second tab in the [Angular demo](demo-ng/), here's a screenshot:
135+
136+
<img src="./screens/radiobuttons.png" width="225px"/>
127137

128138
## Demo Setup
129139
* npm i

angular/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ export type CheckableView = {checked: boolean} & View;
2424
* ```
2525
*/
2626
@Directive({
27-
selector: "CheckBox[ngModel], CheckBox[formControlName], checkBox[ngModel], checkBox[formControlName], check-box[ngModel], check-box[formControlName]",
27+
selector: "CheckBox[ngModel], CheckBox[formControlName], CheckBox[formControl], checkBox[ngModel], checkBox[formControlName], checkBox[formControl], check-box[ngModel], check-box[formControlName], check-box[formControl]",
2828
providers: [CHECKED_VALUE_ACCESSOR]
2929
})
30-
export class CheckedValueAccessor extends BaseValueAccessor<CheckableView> {
30+
export class CheckedValueAccessor extends BaseValueAccessor<CheckableView> {
3131

3232
constructor(@Inject(ElementRef) elementRef: ElementRef) {
3333
super(elementRef.nativeElement);

0 commit comments

Comments
 (0)