we have some radio buttons and when we tried to be set as selected by default when the page is loaded. How can we do that?
Please note, that the actual value of checked attribute does not actually matter; it’s just a convention to assign “checked”. Most importantly, strings like “true” or “false” don’t have any special meaning.
If we don’t aim for XHTML conformance, we can simplify the code to:
This doesn’t exactly answer the question but for anyone using AngularJS trying to achieve this, the answer is slightly different. And actually the normal answer won’t work.
our html will look pretty similar to the normal radio button:
In our controller we declared the mValue that is associated with the radio buttons. To have one of these radio buttons preselected, assign the $scope variable associated with the group to the desired
This makes the “second” radio button selected on loading the page