Curriculum
Course: AngularJS
Login

Curriculum

AngularJS

AngularJS Tutorial

0/65
Text lesson

Radiobuttons

Use the ng-model directive to bind radio buttons to your application; while radio buttons can have different values, only the selected button’s value will be used.

Example

Show some text depending on the value of the selected radio button.

<form>
  Pick a topic:
  <input type=”radio” ng-model=”myVar” value=”dogs”>Dogs
  <input type=”radio” ng-model=”myVar” value=”tuts”>Tutorials
  <input type=”radio” ng-model=”myVar” value=”cars”>Cars
</form>

The value of myVar will be either “dogs,” “tuts,” or “cars.”