I am new to Angular and I am trying to get the value of the switch that the user selected using the ng model. But I do not get any result in the "selected contact".
Here is my HTML
<!doctype html> <html ng-app> <head> <script src="http://code.angularjs.org/1.2.0rc1/angular.min.js"></script> <script src="script.js"></script> </head> <body> <form name="myForm" ng-controller="Ctrl"> <table border="0"> <th>Contact Type</th> <tr ng-repeat="contact in contacttype"><td> <input type="radio" ng-model="contactname" name="group1" value="{{contact.name}}">{{contact.name}} </td> </td></tr></table> <tt>selected contact = {{contactname}}</tt><br/> </form> </body> </html>
Below is my main.js
function Ctrl($scope) { $scope.contacttype = [ {name: 'Both' }, {name: 'User'}, {name: 'Admin'} ]; }
What am I doing wrong here? Failed to find out !!!
javascript angularjs angularjs-scope
Shrey Shivam Sep 03 '13 at 13:56 on 2013-09-03 13:56
source share