0

I am having hard time figuring out how to work with radio buttons in Angular. Here is my fiddle: http://jsfiddle.net/3bp2t4ma/

<div class="form-row full-width pull-left text-center check-as">
                                        <label> <input name="ticket" type="radio"
                                             ng-model="ticketType.type" ng-value="query"> Query
                                        </label> <label class="complaint-check"> <input name="ticket"
                                            type="radio" ng-model="tickeType.type"  ng-value="complaint">
                                            Complaint
                                        </label>
                                    </div>

                         {{ ticketType | json }}   

And javascript:

var myApp = angular.module('myApp', []);

function Main($scope) {

 $scope.ticketType={type: 'query'};


}

Any idea why ticketType becomes empty when I click on radio button?

1 Answer 1

1

Well, there is one obvious typo in the Complaint button: ng-model="tickeType.type"

You're missing a t.

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

1 Comment

Is there a reason you're using ng-value instead of value? ng-value will try to look for the value in your scope (the value of $scope.complaint), rather than just using the string 'complaint'.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.