question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using reactive forms with nb-radio

See original GitHub issue

Issue type

I’m submitting a …

  • bug report
  • feature request

Issue description

Current behavior: Currently nb-radio doesn’t work with reactive forms: Adding a formControlName="foo" attribute throws an error:

ERROR Error: No value accessor for form control with name: 'foo'

Expected behavior: It would be nice to be able to use nb-radio with reactive forms and get the value through the formControlName

Steps to reproduce: See related code

Related code: https://angular-agj9xr.stackblitz.io

Other information:

npm, node, OS, Browser See stackblitz example

Angular, Nebular

    "@angular/animations": "^7.0.0",
    "@angular/cdk": "^7.0.0",
    "@angular/common": "^7.0.1",
    "@angular/compiler": "^7.0.1",
    "@angular/core": "^7.0.1",
    "@angular/forms": "^7.0.1",
    "@angular/platform-browser": "^7.0.1",
    "@angular/platform-browser-dynamic": "^7.0.1",
    "@angular/router": "^7.0.1",
    "@nebular/theme": "^3.0.0",

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
danbetecommented, Feb 20, 2020

ok, i figured it out, this will NOT work with value as: <nb-radio value='false'>no</nb-radio> instead do: <nb-radio [value]='false'>no</nb-radio>

full example:

          <nb-radio-group formControlName='someControllerName' name='someName'>
            <nb-radio [value]='true'>yes</nb-radio>
            <nb-radio [value]='false'>no</nb-radio>
          </nb-radio-group>

BTW i’m on nebular 4.5.0

1reaction
TomasTopinkacommented, Aug 9, 2019

Using latest ngx-admin with Nebular 4.1.2 and still not working, can you provide example with Reactive form ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nebular 1900 Radio Form Control Required - StackBlitz
<nb-radio-group. formControlName="radio">. <nb-radio *ngFor="let option of ... <p>Form status: {{ formGroup.status. }}</p>. </form>. </nb-card-body>.
Read more >
Angular 5 Reactive Forms - Radio Button Group - Stack Overflow
I have 2 radio buttons, I'm using reactive forms and I have added the form controls within my component. The issue I am...
Read more >
Nebular - Radio Angular UI Component - GitHub Pages
Customizable Angular UI Library based on Eva Design System with 40+ UI components, 4 visual themes, Auth and Security modules.
Read more >
Angular Radio Button and Checkbox Example
Reactive form uses FormGroup and FormControl classes to handle form elements. Now let us discuss complete example step by step. Contents.
Read more >
Radio & Radio Group - Ignite UI for Angular - Infragistics
... options for users to select for better UI in template-driven and reactive forms. ... Radio buttons can be displayed using the following...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found