我有一些复选框,我需要获取单击按钮时选中的所有复选框的计数,这是下面的代码,我也有
app.component.html
<div class="col-md-3" id="leftNavBar">
<ul *ngFor="let item of nestedjson">
<li class="parentNav">{{item.name}}</li>
<li class="childData">
<ul>
<li *ngFor="let child of item.value">{{child}}<span class="pull-right"><input type="checkbox"></span></li>
</ul>
</li>
</ul>
<div><button type="submit">Submit</button></div>
</div>
app.component.ts
import { Component } from "@angular/core";
@Component({
selector: "my-app",templateUrl: "./app.component.html",styleUrls: ["./app.component.css"]
})
export class AppComponent {
nestedjson = [
{ name: "parent1",value: ["child11","child12"] },{ name: "parent2",value: ["child2"] },{ name: "parent3",value: ["child3"] }
];
}