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.

formControl for multi select

See original GitHub issue

I’m submitting a …

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior I use ReactiveFormsModule and when i add formControl to multi select element i can’t make it working. I get this error:

core.umd.js:3462 EXCEPTION: Uncaught (in promise): Error: Error in http://localhost:3000/app/components/category.component.js class CategoryComponent - inline template:0:1701 caused by: values.map is not a function

Expected behavior I should use formControl to bind the multi select selected items to a variable. For example i could add to the select tag [formControl]="myForm.controls.cities" and get all selected items in myForm.controls.cities.value.

Minimal reproduction of the problem with instructions If i use select it works with no problems:

        <select class="ui fluid dropdown" [formControl]="myForm.controls.category">
            <option *ngFor="let item of categories" value="{{item}}">{{item}}</option>
        </select>

If i use select multiple it doesn’t work:

        <select multiple="" class="ui fluid dropdown" [formControl]="myForm.controls.category">
            <option *ngFor="let item of categories" value="{{item}}">{{item}}</option>
        </select>

Here is a Plunker

What is the motivation / use case for changing the behavior? The use case is a select menu in which users can select more than choice.

Please tell us about your environment: I’m on Linux Mint, using WebStorm as IDE and Gulp as build pipeline.

  • Angular version: 2.0.X I’m using Angular 2.0.
  • Browser: I tried it on Chromium and Firefox.
  • Language: Typescript 2.0.2, ES5

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
pkozlowski-opensourcecommented, Oct 4, 2016

Thnx @fxck and @DzmitryShylovich for helping out with the issues!

0reactions
angular-automatic-lock-bot[bot]commented, Sep 9, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular2 formControl for select multiple - Stack Overflow
I'm using Sematinc-UI and Angular2 ReactiveFormsModule form and i'd like to use [formControl] for select multiple. If i use select it works with ......
Read more >
SelectMultipleControlValueAccessor - Angular
The ControlValueAccessor for writing multi-select control values and listening to multi-select control changes. The value accessor is used by the ...
Read more >
Angular Mat Select Multi With Formcontrol - StackBlitz
Editor Preview Both. Sign in. Project. Search. Settings. Switch to Light Theme. Enter Zen Mode. Project. Download Project. Info. Angular Mat Select Multi...
Read more >
Form Support in Angular MultiSelect component - Syncfusion
The FormGroup is used to declare formGroupName for the form and the FormControl is used to declare formControlName for form controls. You can...
Read more >
Learn Angular : Multiselect Dropdown In Angular Reactive Form
In this Angular tutorial, you'll learn how to use multi select dropdown in Angular Reactive Forms. I already did a video showing how...
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