Iman Sedighi Iman Sedighi - 4 months ago 6
AngularJS Question

Check a radio button if ngModel is not equal to a fixed value

I have two radio buttons. I wanna check the first radio button if ngModel has value of X, and if ngModel has any value other than X then the second radio button must be checked. It means the second radio button doesn't have a fixed value. It can be anything except X.
I can't achieve this with following code:

<input type="radio" ng-model="" value="x">
<input type="radio" ng-model="" value="">

So in this case if is equal to x then first radio is checked but if is not equal to x then none of the radio are checked by default.
How can I fix the second radio button's problem?

<input type="radio" ng-model="" ng-checked=" == 'x'" value="x">