docs(radio): improve API docs behind radio and link to related API docs

references #6466
This commit is contained in:
Brandy Carney
2016-05-10 18:23:58 -04:00
parent b1c7985252
commit a495ed1eaf
2 changed files with 36 additions and 23 deletions

View File

@ -9,25 +9,38 @@ import {RadioGroup} from './radio-group';
/** /**
* @description * @description
* A radio button with a unique value. Note that all `<ion-radio>` * A radio button is a button that can be either checked or unchecked. A user can tap
* components must be wrapped within a `<ion-list radio-group>`, * the button to check or uncheck it. It can also be checked from the template using
* and there must be at least two `<ion-radio>` components within * the `checked` property.
* the radio group.
* *
* See the [Angular 2 Docs](https://angular.io/docs/ts/latest/guide/forms.html) for * Use an element with a `radio-group` attribute to group a set of radio buttons. When
* more info on forms and input. * 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 * @usage
* ```html * ```html
* * <ion-list radio-group [(ngModel)]="relationship">
* <ion-item> * <ion-item>
* <ion-label>Radio Label</ion-label> * <ion-label>Friends</ion-label>
* <ion-radio value="radio-value"></ion-radio> * <ion-radio value="friends" checked></ion-radio>
* </ion-item> * </ion-item>
* * <ion-item>
* <ion-label>Family</ion-label>
* <ion-radio value="family"></ion-radio>
* </ion-item>
* <ion-item>
* <ion-label>Enemies</ion-label>
* <ion-radio value="enemies" [disabled]="isDisabled"></ion-radio>
* </ion-item>
* </ion-list>
* ``` * ```
* @demo /docs/v2/demos/radio/ * @demo /docs/v2/demos/radio/
* @see {@link /docs/v2/components#radio Radio Component Docs} * @see {@link /docs/v2/components#radio Radio Component Docs}
* @see {@link ../RadioGroup RadioGroup API Docs}
*/ */
@Component({ @Component({
selector: 'ion-radio', 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() @Input()
get value(): any { 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() @Input()
get checked(): boolean { 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() @Input()
get disabled(): boolean { get disabled(): boolean {
@ -155,8 +168,6 @@ export class RadioButton {
*/ */
ngOnDestroy() { ngOnDestroy() {
this._form.deregister(this); this._form.deregister(this);
if (this._group) { this._group && this._group.remove(this);
this._group.remove(this);
}
} }
} }

View File

@ -11,12 +11,13 @@ const RADIO_VALUE_ACCESSOR = new Provider(
/** /**
* @name RadioGroup * @name RadioGroup
* @description * @description
* A radio group is a group of radio button components, and its value * A radio group is a group of [radio buttons](../RadioButton). It allows
* comes from the checked radio button's value. Selecting a radio * a user to select at most one radio button from a set. Checking one radio
* button in the group unchecks all others in the group. * 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) * See the [Angular Forms Docs](https://angular.io/docs/ts/latest/guide/forms.html)
* for more info on forms and inputs. * for more information on forms and inputs.
* *
* @usage * @usage
* ```html * ```html
@ -56,6 +57,7 @@ const RADIO_VALUE_ACCESSOR = new Provider(
* *
* @demo /docs/v2/demos/radio/ * @demo /docs/v2/demos/radio/
* @see {@link /docs/v2/components#radio Radio Component Docs} * @see {@link /docs/v2/components#radio Radio Component Docs}
* @see {@link ../RadioButton RadioButton API Docs}
*/ */
@Directive({ @Directive({
selector: '[radio-group]', selector: '[radio-group]',