🚀 Socket Launch Week Day 4:Socket MCP Adds Org Alerts, Threat Feed Review, and Package Inspection.Learn more
Sign In

@angular2-material/radio

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@angular2-material/radio

Angular 2 Material radio

Source
npmnpm
Version
2.0.0-alpha.7-10
Version published
Weekly downloads
83
-39.86%
Maintainers
1
Weekly downloads
 
Created
Source

MdRadio

Radio buttons allow the user to select one option from a set. Use radio buttons for exclusive selection if you think that the user needs to see all available options side-by-side.

Preview

Setup

Importing the symbols:

import { MdRadioModule } from '@angular2-material/radio';

Adding providers and directives:

@NgModule({
  imports: [MdRadioModule],
  ...
})
export class MyAppModule { }

Examples

A basic radio group would have the following markup.

<md-radio-group>
  <md-radio-button value="option_1">1</md-radio-button>
  <md-radio-button value="option_2">2</md-radio-button>
</md-radio-group>

A dynamic example, populated from a data variable:

<md-radio-group [(value)]="groupValue">
  <md-radio-button *ngFor="let d of data" [value]="d.value">
    {{d.label}}
  </md-radio-button>
</md-radio-group>

A dynamic example for use inside a form showing support for [(ngModel)]:

<md-radio-group [(ngModel)]="chosenOption">
  <md-radio-button *ngFor="let o of options" [value]="o.value">
    {{o.label}}
  </md-radio-button>
</md-radio-group>

<md-radio-group>

Properties

NameTypeDescription
selectedMdRadioButtonThe currently selected button.
valueanyThe current value for this group.
disabledbooleanWhether the group is disabled.

When selection is changed, an event is emitted from the change EventEmitter property.

Notes

The md-radio-group component has no button initially selected.

<md-radio-button>

Properties

Name (attribute)TypeDescription
idstringThe unique ID of this radio button.
namestringGroup name, defaults to parent radio group if present.
valueanyThe value of this radio button.
checkedbooleanWhether the radio is checked.
disabledbooleanWhether the radio is disabled.
aria-labelstringUsed to set the aria-label attribute of the underlying input element.
aria-labelledbystringUsed to set the aria-labelledby attribute of the underlying input element.
                             If provided, this attribute takes precedence as the element's text alternative. |

When checked, an event is emitted from the change EventEmitter property.

Notes

  • The md-radio-button component by default uses the accent color from the theme palette.

Keywords

angular

FAQs

Package last updated on 31 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts