Reputation: 129
I am trying to display a table with hashmap values.
my js hashmap is following:
self.userList["user1"] = {sms:true,email:false}
self.userList["user2"] = {sms:false,email:false}
self.userList["user3"] = {sms:true,email:true}
self.userList["user4"] = {sms:false,email:false}
and my view is following:
<tr ng-repeat="(user,value) in editRulesCtrl.userList">
<td>
{{user}}
</td>
<td>
<md-checkbox ng-model="{{value.sms}}"></md-checkbox>
</td>
<td >
<md-checkbox ng-model="{{value.email}}"></md-checkbox>
</td>
</tr>
Not sure what I am doing wrong, but table shows up empty.
Upvotes: 1
Views: 145
Reputation: 136174
This should work, only problem I can see is, ng-model
needs variable name
, it does failed if you try to pass {{}}
(interpolation) to it.
<tr ng-repeat="(user,value) in editRulesCtrl.userList">
<td>
{{user}}
</td>
<td>
<md-checkbox ng-model="value.sms"></md-checkbox>
</td>
<td>
<md-checkbox ng-model="value.email"></md-checkbox>
</td>
</tr>
Upvotes: 2