Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot pass angular variable to boxType Property #115

Open
mmerbes opened this issue Aug 8, 2019 · 1 comment
Open

Cannot pass angular variable to boxType Property #115

mmerbes opened this issue Aug 8, 2019 · 1 comment

Comments

@mmerbes
Copy link

mmerbes commented Aug 8, 2019

  • 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.

@PabloPG
Copy link

PabloPG commented Jan 2, 2020

You need to create two checkbox with *ngIf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants