I have a component
timeBoxSelector HTML:
<input type="checkbox" [(ngModel)]="selected">
TS:
@Component({
...
})
export class TimeboxComponent implements OnInit {
@Input() selected: boolean;
constructor() {}
ngOnInit() {
console.log('Selected: ', this.selected);
}
}
Now, when I create
<app-timebox selected="false"><app-timebox/>
<app-timebox selected="true"><app-timebox/>
In both cases, the checkbox initially appears as selected. Why is this the case, and how can I fix it?
Aucun commentaire:
Enregistrer un commentaire