[英]ractive.js multiple checkboxes
This is much like the common multiple checkbox question all over the web, except my list of checkboxes is dynamic. 除了我的复选框列表是动态的之外,这与网上常见的多个复选框问题非常相似。
Simplified: 简化:
{{#user}}
<h2>Roles</h2>
{{#allRoles:roleIndex}}
<input type='checkbox' name='{{roles}}' value='{{.id}}'> {{.name}}<br>
{{/}}
{{/}}
I want to iterate over allRoles (in ~/) and get an array of checked boxes in user.roles but since {{#allRoles:roleIndex}} changes the keypath, I cant figure out how to put roles inside user. 我想遍历allRoles(在〜/中)并在user.roles中获得一组复选框,但是由于{{## AllRoles:roleIndex}}更改了键路径,因此我无法弄清楚如何在用户中放置角色。
Sometimes the obvious is too obvious. 有时显而易见的东西太明显了。
name='{{user.roles}}' is what I needed name ='{{user.roles}}'是我所需要的
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.