I have a scoped object in my controller which sets some default values in my app, like this:
//set default values for form
$scope.appText = {
'size':'normal',
'colour':'green',
'alignment':'top',
'dimensions':{
'width':600,
'height':300
}
};
In my view I have a series of HTML radio buttons, each with an ng-value which has an object with a width and a height, like so:
<input type="radio" name="radio-dimensions" ng-value="{width:600, height:300}" ng-model="appText.dimensions" checked>600x300
<input type="radio" name="radio-dimensions" ng-value="{width:300, height:250}" ng-model="appText.dimensions">300x250
I can't make the first radio button be checked by default, even though its ng-value matches the model.
How do I make it checked by default? I've tried adding
ng-checked="true"
which doesn't work, and I don't think is recommended. This jsfiddle illustrates the problem: