0

I have the following in a jade file

....
input(id='prefChangeY', type='radio', ng-value='Yes', ng-model='form.prefChange', name='prefChange', on-focus="fieldInfo='Select yes to change your pref'")
.....
input(id='prefChangeN', type='radio', ng-value='No', ng-model='form.prefChange', name='prefChange', on-focus="fieldInfo='Select no to change your pref'")
.....

In the controller I have the following code

$scope.form.prefChange = 'No';

Unfortunately, I am unable to get the No radio button to be selected by default.

Any assistance will be much appreciated.

Melroy

2 Answers 2

2

Use value instead of ng-value. Check the doc.

value='Yes'
value='No'

Demo: http://jsfiddle.net/LNWNz/

Sign up to request clarification or add additional context in comments.

Comments

1

The attribute for the value when selected is not ng-value but simply value.

See http://docs.angularjs.org/api/ng.directive:input.radio

<input type="radio"
   ng-model="{string}"
   value="{string}"
   [name="{string}"]
   [ng-change="{string}"]>

1 Comment

To be fair: sza actually answered this correctly first. I first gave a wrong answer because I misread the question and then deleted, edited and undeleted it. sza was a little faster with his answer then. So the answer by sza should be "Accepted" in my opinion.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.