我使用的是Angular 4,我在组件的html模板文件中的组件上有一个复选框:
<input type="checkbox" (change)="canBeEditable($event)">
在我的部件上.ts文件我有一个设置为真的值.
toggleEditable() {
this.contentEditable = true;
}
我的问题是,如果选中复选框,我只希望更改值.
所以它看起来像:
toggleEditable() {
if (checkbox is checked) {
this.contentEditable = true;
}
}
我该怎么做?