Multicheckbox无法点击(根本没有检查)

发布于 2025-01-20 11:33:05 字数 686 浏览 2 评论 0原文

我想在网格单元格中渲染多个复选框。 我尝试了Forly Multicheckbox。但是,复选框甚至没有渲染。因此,我试图以这种方式进行操作,但是这样它根本没有被检查。 目前,我不希望在复选框上完成任何事件,我只希望它检查用户未检查。 to.labels 来自另一项服务。在.ts文件中,我有:

public ngOnInit{
console.log(this.to.labels) }

有人可以帮忙吗?

<div class="inline-div" *ngFor="let item of to.labels | keyvalue; let idx=index">
<input type="checkbox" id="custom-multicheckbox">
<label class="form-check-label" for="custom-multicheckbox">{{item.value.value}}</label>
</div>

标签就像一个数组,

0: { id:1, label:'P'}
1: {id:2, label:'R'}

我认为问题是复选框在网格上,因此网格单元格越来越活跃,而不是复选框。请建议如何在网格单元中激活复选框。

I wanted to render multiple checkbox in a grid cell.
I tried with formly multicheckbox. But with that, the checkboxes were not even rendering. So I tried to do it in this way, but in this way it's not being checked at all.
Right now, I don't want any event to be done on checkbox, I just want it to checkec unchecked by user. to.labels is coming from another service. In .ts file, I am having :

public ngOnInit{
console.log(this.to.labels) }

Can someone please help?

<div class="inline-div" *ngFor="let item of to.labels | keyvalue; let idx=index">
<input type="checkbox" id="custom-multicheckbox">
<label class="form-check-label" for="custom-multicheckbox">{{item.value.value}}</label>
</div>

to.labels is like an array

0: { id:1, label:'P'}
1: {id:2, label:'R'}

I think the problem is the checkboxes are on a grid, so the grid cell is getting active and not the checkbox. Please suggest how to activate checkbox in a grid cell.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烦人精 2025-01-27 11:33:05

为什么您使用item.value.value?而不是项目。

您可以这样尝试:

<div class="inline-div" *ngFor="let item of to.labels | keyvalue; let idx=index">
   <input type="checkbox" />
   <label
     class="form-check-label"
     value="item.value"
   ></label>
 </div>

why you are using item.value.value? instead of item.value

you could try this way:

<div class="inline-div" *ngFor="let item of to.labels | keyvalue; let idx=index">
   <input type="checkbox" />
   <label
     class="form-check-label"
     value="item.value"
   ></label>
 </div>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文