Code Monkey home page Code Monkey logo

ui-select2's Introduction

ui-select2 (deprecated) Build Status

Annoucement

This directive is now obsolete. A new initiative, more active, and 100% angular is available at https://github.com/angular-ui/ui-select.

As development slowed down on ui-select2, it is getting unlikely that bugs will be fixed. So the new alternative should be used as soon as possible.

Description

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

Requirements

Setup

  1. Install Karma, Grunt and Bower $ npm install -g karma grunt-cli bower
  2. Install development dependencies $ npm install
  3. Install components $ bower install
  4. ???
  5. Profit!

Testing

We use Grunt to check for JavaScript syntax errors and execute all unit tests. To run Grunt, simply execute:

$ grunt

This will lint and test the code, then exit. To have Grunt stay open and automatically lint and test your files whenever you make a code change, use:

$ grunt karma:server watch

This will start a Karma server in the background and run unit tests in Firefox and PhantomJS whenever the source code or spec file is saved.

Usage

We use bower for dependency management. Install AngularUI Select2 into your project by running the command

$ bower install angular-ui-select2

If you use a bower.json file in your project, you can have Bower save ui-select2 as a dependency by passing the --save or --save-dev flag with the above command.

This will copy the ui-select2 files into your bower_components folder, along with its dependencies. Load the script files in your application:

<link rel="stylesheet" href="bower_components/select2/select2.css">
<script type="text/javascript" src="bower_components/jquery/jquery.js"></script>
<script type="text/javascript" src="bower_components/select2/select2.js"></script>
<script type="text/javascript" src="bower_components/angular/angular.js"></script>
<script type="text/javascript" src="bower_components/angular-ui-select2/src/select2.js"></script>

(Note that jquery must be loaded before angular so that it doesn't use jqLite internally)

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>

Options

All the select2 options can be passed through the directive. You can read more about the supported list of options and what they do on the Select2 Documentation Page

myAppModule.controller('MyController', function($scope) {
    $scope.select2Options = {
        allowClear:true
    };
});
<select ui-select2="select2Options" ng-model="select2">
    <option value="one">First</option>
    <option value="two">Second</option>
    <option value="three">Third</option>
</select>

Some times it may make sense to specify the options in the template file.

<select ui-select2="{ allowClear: true}" ng-model="select2">
    <option value="one">First</option>
    <option value="two">Second</option>
    <option value="three">Third</option>
</select>

To define global defaults, you can configure the uiSelect2Config injectable:

myAppModule.run(['uiSelect2Config', function(uiSelect2Config) {
	uiSelect2Config.placeholder = "Placeholder text";
}]);

Working with ng-model

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.

Working with dynamic options

ui-select2 is incompatible with <select ng-options>. For the best results use <option ng-repeat> instead.

<select ui-select2 ng-model="select2" data-placeholder="Pick a number">
    <option value=""></option>
    <option ng-repeat="number in range" value="{{number.value}}">{{number.text}}</option>
</select>

Working with placeholder text

In order to properly support the Select2 placeholder, create an empty <option> tag at the top of the <select> and either set a data-placeholder on the select element or pass a placeholder option to Select2.

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

ng-required directive

If you apply the required directive to element then the form element is invalid until an option is selected.

Note: Remember that the ng-required directive must be explicitly set, i.e. to "true". This is especially true on divs:

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

Using simple tagging mode

When AngularJS View-Model tags are stored as a list of strings, setting the ui-select2 specific option simple_tags will allow to keep the model as a list of strings, and not convert it into a list of Select2 tag objects.

<input
    type="hidden"
    ui-select2="select2Options"
    ng-model="list_of_string"
    >
myAppModule.controller('MyController', function($scope) {
    $scope.list_of_string = ['tag1', 'tag2']
    $scope.select2Options = {
        'multiple': true,
        'simple_tags': true,
        'tags': ['tag1', 'tag2', 'tag3', 'tag4']  // Can be empty list.
    };
});

ui-select2's People

Contributors

adiroiban avatar ajoslin avatar baconsoap avatar bennick avatar bignall avatar burgov avatar cymantic avatar dandoyon avatar dmitry-dedukhin avatar doogd avatar douglasduteil avatar edwardhotchkiss avatar homerjam avatar joshkurz avatar kadamwhite avatar kbanman avatar krohrsb avatar lkptrzk avatar milosmosovsky avatar petebacondarwin avatar pkozlowski-opensource avatar proloser avatar ranska avatar richardtowers avatar sdornan avatar sja avatar slav avatar sudhirrs avatar teamon avatar wesleycho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ui-select2's Issues

undefined as default?

I have an issue where after initialization Select2 is showing "undefined".

The code itself is like this:

<select id="txtReason" data-ng-model="itemToAdd.Reason" data-ui-select2="{width:'224px'}" onfocus="$( this ).select2( 'open' );" required="required">
    <option data-ng-repeat="reason in reasons" value="{{reason.Name}}">{{reason.Name}}</option>
</select>

I tracked the issue down to elm.trigger('change'); within watch initialization. It forces select2 change event, which grabs current option from select to show, which apparently is undefined.

Using select2 3.4.1 and angular js 1.1.5

If I provide placeholder everything works fine... But without it things are broken.

Any advise on how to fix this?
Thanks.

select2 never initialized when using <input type="hidden"> for tagging

I have the following html:

<input data-ui-select2="defaultTags" 
       data-ng-model="item.Tags" 
       class="tag-list" 
       type="hidden" 
       value="importante, c123, gianluca"/>

in console I get this error: "query function not defined for Select2 undefined"

Using pure jquery plugin like the following it was working as expected:

$('.tag-list', $target).select2({
   tags: ["importante", "da leggere"]
   , placeholder: 'aggiungi tag...'
});

but with ui-select2 don't work, giving the above error.

Disabled state not set if ng-disabled is false on initialization.

Hi!
When using ng-disabled, if the inital value is false, the select2 element is not disabled because

attrs.$observe('disabled',

is fired before element creation in $timeout function.
As a temporay workaround, i've add the folliwing line after the render call :

elm.select2('enable', !scope.$eval(attrs.ngDisabled));

Minification doesn't work

I can't seem to get ui-select2 to work when minifying my JavaScript. The order of the includes is:

  1. jQuery
  2. AngularJS
  3. Select2
  4. Angular-Select2

The error I am getting is:
TypeError: Object [object Object] has no method 'select2'

Select2 closeOnSelect issue

Hi,
I originally wrote this issue on the angular-ui site and will give it a try here. This feature would allow the end-user to make multiple selections without pressing in the box each time.
I'm using version 3.3.1 of select2, 0.4.0 of angular-ui and setting multiple="multiple" and closeOnSelect='false' but the close event happens regardless of setting. The following illustrates issue.
http://plnkr.co/edit/y4tTumkYPjlwqomWfKNQ?p=preview
TIA
John

provide API for setting focus

Currently I don't think there's a way to programmatically / declaratively set the focus to a select2 instance on some event or from inside a watch function, so you have to do something like $('#mySelect2').select2('focus', true) where mySelect2 is something like <input type="hidden" id="mySelect2" ui-select2="select2opts" ...>.

ngHide and ngShow ignored

Hi,
when I declare an option with ngShow or ngHide directives, select2 ignores the condition and always shows the option.

Duplicate options in select-option ng-repeat

I'm getting duplicate items in the drop down when using ng-repeat on option inside the select list.

It looks something like this:

snapflow

This is an example of one of the inputs.

<select id="operational_group"
                  class="operational-group"
                  ui-select2="operationalGroupOptions"
                  ng-model="selectedJob.operational_group">
            <option value=""></option>
            <option ng-repeat="(key, jobRole) in jobRoleList"
                    value="{{ jobRole.id }}">{{ jobRole.name }}
            </option>
          </select>

Not entirely sure why this is occurring. I am running $compile on these inputs, so this may have something to do with it. If I find a solution, ill be sure to post it, but any help is appreciated!

Data as an object with text function

Taken from http://ivaynberg.github.io/select2/

data array/object

Options for the built in query function that works with arrays.
If this element contains an array, each element in the array must contain id and text keys

Alternatively, this element can be specified as an object in which results key must contain the data as an array and a text key can either be the name of the key in data items that contains text or a function that retrieves the text given a data element from the array

Is this functionality supported in this version of select2?

I've created a jsfiddle with what I think is the right syntax but I haven't been able to get it to display the item using the text function.

http://jsfiddle.net/h6Dnz/3/

Thanks,
Jamie

Geting an error when used inside a custom directive

IE 10 & jQuery 1.8.3 bug with disabled input

Had gotten into this bug, while trying to fix not shown value of disabled input.
This is mostly jQuery bug, but it affects this lib and workaround can be made.
With jQuery 1.10.2, this code doesn't work in IE10 for all inputs

if (this.select) {
                this.select
                    .val(val)
                    .find(":selected").each2(function (i, elm) {
                        data = self.optionToData(elm);
                        return false;
                    });
               this.updateSelection(data);

Mostly because this.select.val(val).find(":selected") returns [], not finding any selected options, when my ng-select's innerhtml looks like `"Option A

Option B Option C"` Same happens with jQuery 1.8.3, but only with disabled inputs. updateSelection gets null, since each2 loop isn't being ran. For this, I did a little workaround, not sure how it will turn out in long term: I switched `elm.select2('val', controller.$viewValue);` on line 49 of directive to "elm.val(controller.$viewValue);" for making select2 handle change event instead of changing value via select2 interface, seems to be working for now. Is there a fix for this?

Unpredictable behaviour of select2 when use it along with angular-ui

Hi guys,

I tried the version 3.4.1 of select2, especially I was interested in simple_tags parameter. In our project we also use angular-ui, which includes select2 directive as well. When I try to use select2 without angular-ui dependency, everything works fine, but when I use it along with angular-ui I get different bugs, like this one: http://plnkr.co/edit/lWVVx0WXnMnl5KGuVVA7?p=preview
Maybe I'm wrong, but from what I understand this is because select2 from angular-ui is outdated and there is some clash between these directives. Could you please advise if there is any plan to integrate the latest changes of select2 with angular-ui or there is any other work around for this issue?

Thanks

UPDATE: Sorry, I've found that angular-ui I've been using is outdated and I should use modular approach instead

no way to update the list of tags

select2 takes a tags options, but ui-select2 provides no way of updating this if the list of tags changes.

might need to watch the options to select2 or something.

select2 doesn't update the view when dynamically changing ng-model values

Moved from: angular-ui/angular-ui-OLDREPO#483

After page has been loaded, the bound value is displayed correctly, but if ng-model was changed, the view gets broken.

With select2 version 3.3.1: http://plnkr.co/edit/vTFqP9pSn9QgJUkPuzRx?p=preview
You can see that after page has been loaded, the selected values are displayed. If you click "Change tags" or "Change tags2" the view gets broken.

With select version 3.2: http://plnkr.co/edit/NITfYJ1tPYatJFmK4UQJ?p=preview the view get bound to correct number of items if you click "Change tags" or "Change tags2", but the values displayed are still broken.

I guess it could work if you keep specific for select2 data format {id: "someId", text: "sometext" }, but then we loose benefits of data binding. It would be at least nice to have ability set some proxy functions to set data to and from select2 and keep bound object to ng-model the same structure as it was before.

Typeahead not working in single select

I am using ui-select2 quite extensively in my project with the 'multiple' option. It all works fine.

I have a couple of places where I need a select box with a single option. I would like to use ui-select2, but I find that I am not able to focus in the search box. Here is the tag. I am not using any options in the controller.

          <select 
            ui-select2
            data-placeholder="Choose a country"
            ng-model="bla.country"
            class= 'input-large'>
            <option ng-repeat = 'c in countries' 
              value='{{c.code}}'>
              {{c.name}}
            </option>
          </select>

Exception in change event of ajax select2

On line: angular.extend(controller.$viewValue, elm.select2('data'));

Stack:

TypeError: Cannot read property '$$hashKey' of null
    at Object.extend (http://localhost:3000/assets/unstable/angular.js?body=1:115:16)
    at http://localhost:3000/assets/angular-ui-select2-original.js?body=1:67:27
    at Object.$get.Scope.$eval (http://localhost:3000/assets/unstable/angular.js?body=1:4425:32)
    at Object.$get.Scope.$apply (http://localhost:3000/assets/unstable/angular.js?body=1:4433:27)
    at Object.ng.config.$provide.decorator.$delegate.__proto__.$apply (<anonymous>:855:30)
    at HTMLInputElement.<anonymous> (http://localhost:3000/assets/angular-ui-select2-original.js?body=1:66:23)
    at HTMLInputElement.jQuery.event.dispatch (http://localhost:3000/assets/jquery.js?body=1:2940:98)
    at HTMLInputElement.jQuery.event.add.elemData.handle (http://localhost:3000/assets/jquery.js?body=1:2750:123)
    at Object.jQuery.event.trigger (http://localhost:3000/assets/jquery.js?body=1:2894:18)
    at HTMLInputElement.<anonymous> (http://localhost:3000/assets/jquery.js?body=1:3350:22) 

Model's value is not updated.

Where can I find uiSelect2Config?

I updated my select2 of the angular-ui to the latest version and encountered the problem of not finding update for the remaining files of the angular-ui, one of them being the core file. In principle "uiSelect2Config" would be defined in this file.

Where can I find this update?

select2 watching options for changes

The documentation shows that you can do something like the following:

myAppModule.controller('MyController', function($scope) {
    $scope.select2Options = {
        allowClear:true
    };
});
<select ui-select2="select2Options" ng-model="select2">
    <option value="one">First</option>
    <option value="two">Second</option>
    <option value="three">Third</option>
</select>

However, changes to $scope.select2Options after that point do nothing. It would be nice if ui-select2 would watch select2Options for changes in that case and send them to select2 when they change.

I need to dynamically change maximumSelectionSize depending on what's selected, and doing something like the following is obviously the wrong thing to do since you shouldn't be messing with the DOM in a controller.

<select id="mySelect2" ui-select2="{ allowClear: true}" ng-model="select2" ng-change="selectChange()">
    <option value="one">First</option>
    <option value="two">Second</option>
    <option value="three">Third</option>
</select>

inside controller:

$scope.selectChange = function() {
    if(...) {
        $("#mySelect2").select2({ maximumSelectionSize: 1 });
    } else {
        $("#mySelect2").select2({ maximumSelectionSize: 0 });
    }
}

How can I pass those types of options through to select2 without using the DOM and mixing concerns in my controller?

select2 doesn't get initialized correctly when using nested ng-repeat with optgroup

I posted the following issue stackoverflow (contains a jsfiddle that shows the issue):

http://stackoverflow.com/questions/16123704/how-to-get-select2-tags-initializing-correctly-with-angular-ui-when-option-group

I have tried digging in to angular-ui to see if I can find what keeps it from getting initialized but the code looks correct:

if (isSelect) {
elm.select2('val', controller.$modelValue);
}

controller.$modelValue is set correctly so it seems like its some kind of refresh issue.

http://jsfiddle.net/tadchristiansen/QRRYf/

Keep original array/arrayLike model object on change

When "change" event is captured, current implementation just get value from select2 and call $setViewValue on controller:

elm.bind("change", function () {
  scope.$apply(function () {
    controller.$setViewValue(elm.select2('data'));
  });
});

So, original object is changed, because select2 provide new array of selected items.. I think that keep original object would be better, something like:

elm.bind("change", function () {
  scope.$apply(function () {
    if(isMultiple && (goog.isArray(controller.$modelValue) || goog.isArrayLike(controller.$modelValue))) {
      var spliceArgs = elm.select2('data');
      spliceArgs.unshift(0, controller.$modelValue.length);
      controller.$modelValue.splice.apply(controller.$modelValue, spliceArgs);
      controller.$setViewValue(controller.$modelValue);
    } else {
      controller.$setViewValue(elm.select2('data'));
    }
  });
});

Select2 not working when ng-show directive

Hi,
I am having the same problem that issue #23 and followed your advice but even when the ng-show directive is on a parent element, it does not work for me : /

Do you have any idea why ?

Using Select2 with fancybox stops working

When Placing into a DIV that is showed dynamically in a fancybox Dialog, the select2 control doesnt even render. But when Input field is changed an error occurs. It used to work until now.

Error: 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: []

Code is Simply as:

    <div style="display: none;">
        <div id="dlgConversation" class="-dlg" data-ng-controller="chatController">
            <h2>Nachricht schreiben</h2>
            <p>
                <input type="text" style="width:300px;" data-ui-select2="tagListOptions.contact" data-ng-model="entity.recipients" />
            </p>
            <p>
                <textarea data-ng-model="entity.text"></textarea>
            </p>
            <p>
                <button data-ng-click="send()">Abschicken</button>
            </p>
        </div>
    </div>

how do i set a preset value of when using data: and json

I've got got a big list of json with properties and children. When i save them off to the database i save the selected value which looks like this:

{
"label": "Annual Revenue",
"rules": [
"is",
"is not",
"less then",
"greater then"
],
"value": {
"type": "number"
},
"text": "Annual Revenue",
"field": "AnnualRevenue",
"id": "AnnualRevenue",
"category": "salesForceLead"
}

how do i preset the value so that when the select 2 direct inits it reads the value off of my ng-model and then sets it in the dropdown... i've tried everything. Basically if i put any value in the ng-model and then select2 inits it overrides my ng-model value with a blank one.

$watch doesn't work if select inside ng-switch

Hello,
I have a strange problem : If ui-select2 is inside ng-switch , i can't use $watch for tracking model changes. I coudn't understand the main cause for this.

You can check this behaviour on this plunker page : http://plnkr.co/edit/oC6zLsrEnFPzHRuW70A5

When you open example code, open console too. If you change top select2, you will see old and new values on console,if you change bottom select2 nothing happens.

Ps : Deep searching, eg true as 3th parameter for $watch, doesn't fix.

Tags option does not work in IE8

When I use tags option in IE8,I can't add or select any tags.
I have also run unit tests in IE8, but it's failed.

Tests result is following:

IE 8.0 (Windows) uiSelect2 with an <input> element consumers of ngModel should correctly use $viewValue should use any formatters if present (input multi select - falsey value) FAILED
        TypeError: Object doesn't support this property or method
IE 8.0 (Windows) uiSelect2 with an <input> element consumers of ngModel should correctly use $viewValue should use any formatters if present (input multi select) FAILED
        TypeError: Object doesn't support this property or method
IE 8.0 (Windows) uiSelect2 with an <input> element consumers of ngModel should correctly use $viewValue should not set the default value using scope.$eval FAILED
        TypeError: Object doesn't support this property or method
IE 8.0 (Windows) uiSelect2 with an <input> element consumers of ngModel should correctly use $viewValue should expect a default value to be set with a call to the render method FAILED
        TypeError: Object doesn't support this property or method
IE 8.0 (Windows) uiSelect2 with an <input> element simple_tags Updating the select2 model will update AngularJS model with a string. FAILED
        Expected [ 't', ',', 'a', 'g', '1', '2' ] to equal [ 'tag1', 'tag2' ].
IE 8.0 (Windows): Executed 30 of 30 (5 FAILED) (1.504 secs / 0.964 secs)

dirty flag when using arrays or promises

If I get values from array (or promise) the dirty flag is set on initialization.

Ej:

<option ng-repeat="item in array" value="{{item.id}}">{{item.name}}</option>

I solved this by checking if array changed on watch:

// Watch the options dataset for changes
                    if (watch) {
                        scope.$watch(watch, function (newVal, oldVal, scope) {
                            if (!newVal) return;
                            // Check if changed ...
                            if (newVal == oldVal) return;
....
}

Variable set to ng-model firing $scope.$watch twice

In html:

<select ng-model="selectedValue">

In js:

$scope.selectedValue = 4; // we set the value to an integer

$scope.$watch('selectedValue', function() {
    // this is fired twice
});

I think this is because select2 stores the values as strings. When we set the value as an integer, ui-select2 converts it to a string. So it is fired first when we change to an integer, and it is fired a second time around when ui-select2 converts it to a string.

Simple_tags not updated after change

When the simple tags gets updated after initialization they won't update.

image

In the screenshot the simple_tags contains 1, 2, 3 after that i update them with these in the debug dialog. These changes are not visible in the select2 directive.

updates hidden input placeholder binding don't update select2 placeholder

Given something like

<input type="hidden" placeholder="{{ PLACEHOLDER | translate }}" ui-select2="select2opts" ...>

the select2's placeholder is initially rendered correctly, but if the value of {{ PLACEHOLDER | translate }} changes after the select2 has been initialized (e.g. because the user has changed her language setting), the select2's placeholder is not updated to match the hidden input's.

Callbacks on select2

Hi there, is there anyway we can do callbacks for select2 on the angular side? ie. on change, select2-open, select2-selecting etc.

select2 with optgroups doesnt get initialized

Hello there,

when I use

<select ng-disabled="_disabled" ng-model="all.categories" multiple="multiple" ui-select2="{ allowClear: true,width: '600px'}">
    <optgroup ng-repeat="category in categories" label="{{category.name}}">
        <option ng-repeat="item in category.children" value="{{item.id}}">{{item.name}}</option>
    </optgroup>
</select>

with latest select2 plugin there is a problem that i dont get selected items from model. I can see that all items are in the options, i can select them, they appear in the select but i cant see already chosen items from model (after refresh). So it wont get initialized.

I found a solution to change line:

repeatOption = tElm.find('option[ng-repeat], option[data-ng-repeat]');

to

repeatOption = tElm.find('optgroup[ng-repeat], optgroup[data-ng-repeat], option[ng-repeat], option[data-ng-repeat]');

so it watches also for ng-repeat in optgroup.

Dont know if it is a clean solution or not but it started to work with it. Can you advise ?

P.S.: I also looked at issue #8 where was said to update to latest version. But it didnt help.

Set the view and model value and update the angular template manually for the ajax/multiple select2

Line 977

On AJAX select2 configurations, the ng-model is only changed once when a user selects an option from the AJAX search. If a user then search's again whilst having the first selection not cleared then the new selection will not update ng-model but will update select2.

This is due to the change event bound on 977 not being fired. I believe it's possibly because select2 isn't firing the change. If I find a solution I will post it.

Break apart proposal

Assorted bullets I have done or need to tackle

  • Continuing repo history from AngularUI
  • Creating component.json with dependencies
  • Creating a ui.select2 module
  • Change ui.config to uiSelect2Config
  • Create docs with subsection from demo page
  • Create super-dumb test runner
  • Add assets as submodules(?)

Missing 0.0.1 git tag for Bower

For Bower to pull this in with a version, you also need to use a git tag.

If I include "angular-ui-select2": "0.0.1" in my components.json, then Bower fails with.

Fatal error: Could not find tag satisfying: angular-ui-select2#0.0.1

latest will work for now, but I prefer to never use a version specifier like that.

Ability to set 'open' on Directive load (e.g. focus on load)

According to the documents for select2 the way to set focus to the select2 element on load is to programmatically call the element.select2('open') call once the select2 root container is established. It would be great to have an option to add a focus or open attribute to this directive which would trigger this.

Select2 Multiple prevent sorting?

This issue has not been fixed:

I'm using the Select2 directive as follows

    <select ui-select2 multiple ng-model="things">
      <option ng-repeat="thins in available_things" ng-value="thing">{{thing}}</option>
    </select>

The problem I have is that the directive seems to order the resulting "things" each time I select a thing but the order in which I select things is important to me.

This is not how Select2 behaves normally and I can't find what's causing this. Would appreciate some insight in how to fix this. "things" is just an array of strings.

Update bower package

Changelog shows ui-select2 is current at version 0.0.4, but bower.json shows 0.0.2. It would be great if it could reflect the latest version. Also, a 0.0.4 tag needs to be created for the repo.

$compile doesn't work with options

I'm trying to $compile some HTML that I'm passing to my Select2 instance for the option formatNoMatches. Unfortunately, it doesn't seem to be rendering correctly. I'm not sure if this is a bug, or simply another Angular concept that I don't yet understand.

$scope.myResponse = $compile('<div style="text-align: center"><h6 class="text-    warning bigger" >No vendors found.</h6><button class="btn btn-primary btn-app btn-small" ng-click="noReturns()"><i class="icon-edit"></i>Add New</button></div>')($scope);
$scope.vendorOptions = {
     formatNoMatches:function(){
         return $scope.myResponse;
     }
};

Issue with displaying model items on load

Hi

When the page loads the items in the ng-model aren't showing in the list. The SELECT is set to multiple.

It's only when I select items that they show. The ng-model is correct so just wondering if there is something I'm missing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.