gpt4 book ai didi

javascript - ng-repeat with hashmap 不在我的 html 表上显示任何内容

转载 作者:行者123 更新时间:2023-11-30 15:10:33 24 4
gpt4 key购买 nike

我正在尝试显示一个包含散列映射值的表。

我的 js HashMap 如下:

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}

我的观点如下:

<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>

不确定我做错了什么,但表格显示为空。

最佳答案

这应该可行,我能看到的唯一问题是,ng-model 需要变量 name,如果您尝试传递 {{}} 它会失败(插值)到它。

<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>

Plunker

关于javascript - ng-repeat with hashmap 不在我的 html 表上显示任何内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45175033/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com