ng-model preventing checked="checked" to select radio button by default

Horace Heaven picture Horace Heaven · Sep 25, 2013 · Viewed 28k times · Source

When I use checked="checked" ng-model prevents the radio button from being selected by default. Does anyone know what could be causing this?

<input type="radio" name="unitMiles" checked="checked" id="unitMiles" value="Miles" ng-model="unit" ng-change='nextActivityStep(3)'>

Answer

tymeJV picture tymeJV · Sep 25, 2013

You should be using the ngChecked directive that comes with Angular.

Doc: http://docs.angularjs.org/api/ng.directive:ngChecked