Saturday, 15 August 2015

angularjs - Angular input type radio with ng-model -



angularjs - Angular input type radio with ng-model -

i having hard time figuring out how work radio buttons in angular. here 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 thought why tickettype becomes empty when click on radio button?

well, there 1 obvious typo in complaint button: ng-model="ticketype.type"

you're missing t.

angularjs

No comments:

Post a Comment