Open mmerbes opened 5 years ago
I am trying set the Checkbox boxType property to the passed variable so it can be either a radio button or checkbox depending on the needs of the component.
<StackLayout orientation="horizontal" verticalAlignment="center"> <CheckBox #elem [checked]="option.selected" (checkedChange)="elem.checked !== option.selected && changeCheckedRadio(option)" class="checkbox" [fillColor]="aColor" [boxType]="boxType"> </CheckBox> <StackLayout verticalAlignment="center"> <Label [text]="option.text" textWrap="true" (tap)="changeCheckedRadio(option)"></Label> </StackLayout> </StackLayout>
export class CheckboxQuestionComponent implements OnInit, SurveyQuestion { radioOptions: Array<CheckboxOption> @Input() radio: boolean = false @Input() question: Question boxType: string = 'circle' aColor: any = 'Red' constructor () { } ngOnInit () { this.boxType = this.radio ? 'circle' : 'square' }
It should be noted that setting the fillColor through an angular variable works perfectly but the boxType fails to do the same.
You need to create two checkbox with *ngIf
I am trying set the Checkbox boxType property to the passed variable so it can be either a radio button or checkbox depending on the needs of the component.
It should be noted that setting the fillColor through an angular variable works perfectly but the boxType fails to do the same.