<div class="content">
<md-slide-toggle color="primary" [(ngModel)]="permission.permission.department.main" [ngModelOptions]="{standalone: true}">On/Off</md-slide-toggle>
</div>
<div *ngIf="permission.permission.department.main" class="content">
<md-checkbox [(ngModel)]="permission.permission.department.view" align="end" [ngModelOptions]="{standalone: true}">View</md-checkbox>
<md-checkbox [(ngModel)]="permission.permission.department.add" align="end" [ngModelOptions]="{standalone: true}">Add</md-checkbox>
<md-checkbox [(ngModel)]="permission.permission.department.edit" align="end" [ngModelOptions]="{standalone: true}">Edit</md-checkbox>
<md-checkbox [(ngModel)]="permission.permission.department.delete" align="end" [ngModelOptions]="{standalone: true}">Delete</md-checkbox>
</div>
答案 0 :(得分:0)
您可以更新更改功能的值,请检查并告诉我您是否还想要其他内容
<md-slide-toggle color="primary"
[(ngModel)]="permission.permission.department.main"
(change)="setValue(permission.permission.department.main,permission.permission.department)"
[ngModelOptions]="{standalone: true}">On/Off</md-slide-toggle>
你的ts文件中的添加一个方法
setValue(currentvalue,p){
for (var key in p) {
if (p.hasOwnProperty(key)) {
p[key]=currentvalue;
}
}
}