Questions tagged [angularjs-select2]

Angular select2 directive allows you to enhance your select elements with behaviour from the select2 library.

All about the famous library select2 by @ivaynberg adapted as a directive for angular.

This directive allows you to enhance your select elements with behaviour from the select2 library.

Usage

AngularJS wrapper for select2 (deprecated)

Instead, use angular-ui/ui-select

Add the select2 module as a dependency to your application module:

var myAppModule = angular.module('MyApp', ['ui.select2']);

Apply the directive to your form elements:

<select ui-select2 ng-model="select2" data-placeholder="Pick a number">
    <option value=""></option>
    <option value="one">First</option>
    <option value="two">Second</option>
    <option value="three">Third</option>
</select>

The ui-select2 directive plays nicely with ng-model and validation directives such as ng-required.

If you add the ng-model directive to same the element as ui-select2 then the picked option is automatically synchronized with the model value.

134 questions
16
votes
3 answers

Does Select2 allow for changing name of "text" key to something else?

I have the following Select2 configuration. $scope.select2Options = { simple_tags: false, placeholder : "Search for a language", multiple : true, contentType: "application/json; charset=utf-8", minimumInputLength : 3, ajax :…
balteo
  • 23,602
  • 63
  • 219
  • 412
12
votes
1 answer

Remove select2 border on active of select element?

I have gone through its css code but not able to find its actually property that is being applied on the main element. i'm making some changes in select2 library so that i can use it in my way. i trapped in its CSS did not get from which property…
ngLover
  • 4,439
  • 3
  • 20
  • 42
11
votes
1 answer

allowClear="true" not works in angular-ui select

How to clear the selected value in angular-ui select. I want something like this
Kalhan.Toress
  • 21,683
  • 8
  • 68
  • 92
9
votes
2 answers

Any examples for integrating Select2 with Angular2 Components?

I've been trying to find a demonstration/example of how to integrate Select2 into an angular 2 component. My end goal is to use select 2 ajax features to populate the dropdown as I start typing in the select box aka…
andycwk
  • 826
  • 2
  • 9
  • 19
8
votes
2 answers

angular select2 slow with largish data set

I'm trying to use select2 with a dataset of 5,000. The interaction is slow, especially the search. I will need to handle datasets of >500,000 sometime in the near future. Any suggestions on how to make this efficient? I have no performance issues…
Jason
  • 1,787
  • 4
  • 29
  • 46
6
votes
4 answers

How to use jQuery Select2 with AngularJS

I am trying to use jQuery (2.2.1) Select2 (3.5.2) with Angularjs (1.5) but am having a difficult time grabbing the data from the select box. I have tried ui-select and I could retrieve data... but would often crash the browser when searching, was…
Alex
  • 509
  • 1
  • 11
  • 26
6
votes
1 answer

ng-repeat continuously fired on hover

I'm using UI-Select 0.8.4 and have a large data set. Then I'm using UI-Select to display property values in a dropdown beside the data set. I'm using that for filters. So when choosing from the dropdown, will filter the results. Every time when I…
Gaui
  • 8,723
  • 16
  • 64
  • 91
6
votes
2 answers

Trying to use angular ui-select2 in tag mode (not simple tag), losing objects

I've recently upgraded from angular 1.1.4 up to 1.2.9, and grabbed the latest ui-select2 directive and the latest select2 component. My select2s in tag mode have stopped working. The options list and typeahead work, but when I select anything from…
5
votes
1 answer

Angular UI Select remove item on click

I am using UI-Select, I noticed that clicking any of the tags makes them blue, which has no purpose for what I would like to do. I would like them removed if clicked. Upon inspection I noticed an 'x' that fires off…
user3196599
5
votes
7 answers

Angular ui-select placeholder not working

We have been using ui-select (https://github.com/angular-ui/ui-select) to theme dropdowns like select2. This functionality has largely been working apart from one aspect: default placeholders. The code largely follows the ui-select demos (3rd…
WillSeabrook
  • 108
  • 1
  • 2
  • 10
5
votes
3 answers

Angular ui-select error: 404 (Failed to load template)

Anyone having issue using angular-ui-select? Getting this error GET http://localhost/select2/select.tpl.html 404 (Not Found) angular.js:8539 Error: [$compile:tpload] Failed to load template: select2/select.tpl.html From the documentation - i just…
Linc Abela
  • 797
  • 2
  • 12
  • 26
5
votes
3 answers

How to initialize a select2 disabled

I have a simple select2 init which I want to be disabled by default without chaining a .select2("enable", false) afterwards. HTML:
DonJuwe
  • 4,477
  • 3
  • 34
  • 59
4
votes
1 answer

Angular 2 ng-select multiple selected values issue

I am working on Angular 2 and used library Angular 2 select component enter link description here I need set default item selected but when I displayed select values I got some error. I have also check this link enter link description here for help…
4
votes
0 answers

select2 multiple dropdown doesn't get repopulated with original values after clearing selected value?

while selecting a value through multi select in select2 value gets deleted from list and is shown in selected value . but if i clear value using $("#mySel2").select2('data', null); value gets cleared from selected option but it is not added back…
4
votes
3 answers

Angular ui-select placeholder not working when ng-model is initialized

I am trying to add a new select every time a button is clicked, The html:
Anubha
  • 1,345
  • 6
  • 23
  • 35
1
2 3
8 9