javascript - How to obtain Checkbox values ( checked by user) using ng-model in AngularJS -


while trying implement checkbox functionality,i not able obtain checkboxes user has selected. how done? below html snippet:

<td>                 <table border="0"><th>tier</th>                 <tr ng-repeat="item in tiertype">                                  <td>                     <label class="checkbox" for="{{item.id}}">                     <input type="checkbox" ng-model="selection.ids[item.id]" name="tier_class" ng-checked="item.checked" id="{{item.id}}"/>{{item.name}}                     </label>                     </td></tr></table>             </td> 

and below javascript snippet:

$scope.tiertype = [                         { id: 1, name: "all", checked: true},                         { id: 2, name: "standard", checked: false },                        { id: 3, name: "unreserved", checked: false },                        { id: 3, name: "reserved", checked: false },                        { id: 4, name: "general", checked: false }                        ]; 

iam not getting proper values on using "check box value= {{selection.ids}}". moreover, on checking checbox, getting checked or checbox id:1 (default). seems strange me, not able figure out. going wrong dont have experience in angularjs.

just set checkbox ng-model boolean value check. ie: ng-model="item.checked"


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -