Skip to content

Cannot pass angular variable to boxType Property #115

Open
@mmerbes

Description

@mmerbes
  • Angular 8.1
  • Nativescript 6.0.3
  • Nativescript-Checkbox 1.0
  • Nativescript-Angular 1.0

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions