我有一个分量
timeBoxSelector HTML:
<input type="checkbox" [(ngModel)]="selected">
TS:
@Component({
...
})
export class TimeboxComponent implements OnInit {
@Input() selected: boolean;
constructor() {}
ngOnInit() {
console.log('Selected: ', this.selected);
}
}
现在,当我创建
<app-timebox selected="false"><app-timebox/>
<app-timebox selected="true"><app-timebox/>
在这两种情况下,作为选择的最初显示的复选框。为什么是这样的话,我怎么能解决这个问题?