From a495ed1eaf8bae36fdf8922db6ab8e90b08d4afd Mon Sep 17 00:00:00 2001 From: Brandy Carney Date: Tue, 10 May 2016 18:23:58 -0400 Subject: [PATCH] docs(radio): improve API docs behind radio and link to related API docs references #6466 --- ionic/components/radio/radio-button.ts | 47 ++++++++++++++++---------- ionic/components/radio/radio-group.ts | 12 ++++--- 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/ionic/components/radio/radio-button.ts b/ionic/components/radio/radio-button.ts index df1f3df9be..eb20252e67 100644 --- a/ionic/components/radio/radio-button.ts +++ b/ionic/components/radio/radio-button.ts @@ -9,25 +9,38 @@ import {RadioGroup} from './radio-group'; /** * @description - * A radio button with a unique value. Note that all `` - * components must be wrapped within a ``, - * and there must be at least two `` components within - * the radio group. + * A radio button is a button that can be either checked or unchecked. A user can tap + * the button to check or uncheck it. It can also be checked from the template using + * the `checked` property. * - * See the [Angular 2 Docs](https://angular.io/docs/ts/latest/guide/forms.html) for - * more info on forms and input. + * Use an element with a `radio-group` attribute to group a set of radio buttons. When + * radio buttons are inside a [radio group](../RadioGroup), exactly one radio button + * in the group can be checked at any time. If a radio button is not placed in a group, + * they will all have the ability to be checked at the same time. + * + * See the [Angular Forms Docs](https://angular.io/docs/ts/latest/guide/forms.html) for + * more information on forms and input. * * @usage * ```html - * - * - * Radio Label - * - * - * + * + * + * Friends + * + * + * + * Family + * + * + * + * Enemies + * + * + * * ``` * @demo /docs/v2/demos/radio/ * @see {@link /docs/v2/components#radio Radio Component Docs} + * @see {@link ../RadioGroup RadioGroup API Docs} */ @Component({ selector: 'ion-radio', @@ -87,7 +100,7 @@ export class RadioButton { } /** - * @private + * @input {any} The value of the radio button. Defaults to the generated id. */ @Input() get value(): any { @@ -100,7 +113,7 @@ export class RadioButton { } /** - * @private + * @input {boolean} Whether the radio button should be checked or not. Default false. */ @Input() get checked(): boolean { @@ -116,7 +129,7 @@ export class RadioButton { } /** - * @private + * @input {boolean} Whether the radio button should be disabled or not. Default false. */ @Input() get disabled(): boolean { @@ -155,8 +168,6 @@ export class RadioButton { */ ngOnDestroy() { this._form.deregister(this); - if (this._group) { - this._group.remove(this); - } + this._group && this._group.remove(this); } } diff --git a/ionic/components/radio/radio-group.ts b/ionic/components/radio/radio-group.ts index 5e8771ba5a..482deac9b7 100644 --- a/ionic/components/radio/radio-group.ts +++ b/ionic/components/radio/radio-group.ts @@ -11,12 +11,13 @@ const RADIO_VALUE_ACCESSOR = new Provider( /** * @name RadioGroup * @description - * A radio group is a group of radio button components, and its value - * comes from the checked radio button's value. Selecting a radio - * button in the group unchecks all others in the group. + * A radio group is a group of [radio buttons](../RadioButton). It allows + * a user to select at most one radio button from a set. Checking one radio + * button that belongs to a radio group unchecks any previous checked + * radio button within the same group. * - * See the [Angular 2 Docs](https://angular.io/docs/ts/latest/guide/forms.html) - * for more info on forms and inputs. + * See the [Angular Forms Docs](https://angular.io/docs/ts/latest/guide/forms.html) + * for more information on forms and inputs. * * @usage * ```html @@ -56,6 +57,7 @@ const RADIO_VALUE_ACCESSOR = new Provider( * * @demo /docs/v2/demos/radio/ * @see {@link /docs/v2/components#radio Radio Component Docs} + * @see {@link ../RadioButton RadioButton API Docs} */ @Directive({ selector: '[radio-group]',