我真的想要功能选择基本功能,但是要有复选框。 如果我打开[multiple],则得到复选框,但同时也获得了多选功能,我需要单选和复选框。
答案 0 :(得分:4)
您可以满足您的要求
这是示例
在cy.unbind('click'); // unbind event to prevent the event to fire
cy.bind('click ', 'node', function (evt) {
// add the node to an array (node is in evt.target())
// if there are 2 nodes in the array, remove them after creating an edge between them
cy.add(//your new edge);
array.splice(0, 2); // remove the first 2 elements of your array
});
app.component.html
和<mat-form-field>
<mat-select placeholder="Toppings">
<mat-option *ngFor="let topping of toppingList; let i =index" [value]="topping">
<mat-checkbox [checked]="selected === i" (change)="onChange(topping);selected = i"> {{topping}}</mat-checkbox>
</mat-option>
</mat-select>
</mat-form-field>
app.component.ts
这是Stackblitz演示