Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

257
Views
Botones de radio de arranque Ng

Estoy usando botones de radio NG-Bootstrap como este

 <div class="btn-group btn-group-toggle" ngbRadioGroup name="radioBasic" formControlName="model"> <label ngbButtonLabel class="btn-primary"> <input ngbButton type="radio" [value]="1"> Left (pre-checked) </label> <label ngbButtonLabel class="btn-primary"> <input ngbButton type="radio" [value]="2"> Middle </label> <label ngbButtonLabel class="btn-primary"> <input ngbButton type="radio" [value]="3"> Right </label> </div>

Y en componente

 this.radioGroupForm = this.formBuilder.group({ 'model': 1, });

Está funcionando bien, porque todos los botones están en una línea, pero ¿qué pasa si necesito un html diferente? Ese tercer botón estará en otro lugar en html, he intentado algo como esto

 <div class="btn-group btn-group-toggle" ngbRadioGroup name="radioBasic" formControlName="model"> <label ngbButtonLabel class="btn-primary"> <input ngbButton type="radio" [value]="1"> Left (pre-checked) </label> <label ngbButtonLabel class="btn-primary"> <input ngbButton type="radio" [value]="2"> Middle </label> </div> <div class="row"> <div class="btn-group btn-group-toggle" ngbRadioGroup name="radioBasic" formControlName="model"> <label ngbButtonLabel class="btn-primary"> <input ngbButton type="radio" [value]="3"> Right </label> </div> </div>

Pero no funciona, hay que envolverlo en un grupo??

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Mirando el código fuente de ngbRadioGroup , creo que es correcto: necesitamos envolver un grupo. Espero que podamos usar ng-container para evitar la adición de HTML:

 <ng-container ngbRadioGroup name="radioBasic" formControlName="model"> <div class="btn-group btn-group-toggle" > <label ngbButtonLabel class="btn-primary"> <input ngbButton type="radio" [value]="1"> Left (pre-checked) </label> <label ngbButtonLabel class="btn-primary"> <input ngbButton type="radio" [value]="2"> Middle </label> </div> <div class="row"> <div class="btn-group btn-group-toggle"> <label ngbButtonLabel class="btn-primary"> <input ngbButton type="radio" [value]="3"> Right </label> </div> </div> </ng-container>
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!