{"id":19339689,"url":"https://github.com/rubenv/angular-select2","last_synced_at":"2025-05-05T04:14:07.008Z","repository":{"id":12491216,"uuid":"15160694","full_name":"rubenv/angular-select2","owner":"rubenv","description":"Select2 directive for Angular.js","archived":false,"fork":false,"pushed_at":"2018-12-06T06:46:54.000Z","size":111,"stargazers_count":62,"open_issues_count":32,"forks_count":52,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-05T04:13:58.968Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rubenv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-13T10:15:22.000Z","updated_at":"2020-07-29T02:05:02.000Z","dependencies_parsed_at":"2022-09-11T01:51:36.376Z","dependency_job_id":null,"html_url":"https://github.com/rubenv/angular-select2","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubenv%2Fangular-select2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubenv%2Fangular-select2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubenv%2Fangular-select2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubenv%2Fangular-select2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rubenv","download_url":"https://codeload.github.com/rubenv/angular-select2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252436586,"owners_count":21747472,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T03:23:24.574Z","updated_at":"2025-05-05T04:14:06.989Z","avatar_url":"https://github.com/rubenv.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# angular-select2\n\n\u003e [select2](http://ivaynberg.github.io/select2/) bindings for Angular.JS\n\n## Installation\nAdd angular-select2 to your project:\n\n```\nbower install --save angular-select2\n```\n\nAdd it to your HTML file:\n\n```html\n\u003cscript src=\"bower_components/angular-select2/dist/angular-select2.min.js\"\u003e\u003c/script\u003e\n```\n\nReference it as a dependency for your app module:\n\n```js\nangular.module('myApp', ['rt.select2']);\n```\n\n## Usage\nUsage a similar to a normal select with `ngOptions`:\n\n```html\n\u003cselect2 ng-model=\"obj.field\" s2-options=\"val.id as val.name for val in values\"\u003e\u003c/select2\u003e\n```\n\n*Note: using `ng-options` was supported until Angular 1.4 made this impossible. When upgrading to Angular.JS 1.4, be sure to replace all instances of `ng-options` to `s2-options`.*\n\nIn fact, you can replace any `\u003cselect\u003e` tag by a `\u003cselect2\u003e` tag and it should just work.\n\nA multi-selection works similarly: add a `multiple` attribute.\n\nYou can set any [select2](http://ivaynberg.github.io/select2/) option by passing an options object:\n\n```html\n\u003cselect2 ng-model=\"obj.field\" s2-options=\"val.id as val.name for val in values\" options=\"{ allowClear: true }\"\u003e\u003c/select2\u003e\n```\n\n## Async loading of data\nAsync-loaded data can by used by leaving out the `s2-options` attribute and by specifying a `query` function:\n\n```js\nangular.module('myApp').controller('MyController', function ($scope) {\n    $scope.queryOptions = {\n        query: function (query) {\n            var data = {\n                results: [\n                    { id: \"1\", text: \"A\" },\n                    { id: \"2\", text: \"B\" }\n                ]\n            };\n\n            query.callback(data);\n        }\n    };\n});\n```\n\n```html\n\u003cselect2 ng-model=\"values.query\" options=\"queryOptions\"\u003e\u003c/select2\u003e\n```\n\n## Custom formatting, restrictions, tokenization, ...\nThis directive is just simple glue to the underlying select2.\n\n[Check the select2 documentation for an overview of the full capabilities.](http://ivaynberg.github.io/select2/)\n\n## Configuring global defaults\nYou can set a default for any option value by using `select2Config`:\n\n```js\nangular.module(\"myApp\").run(function (select2Config) {\n    select2Config.minimumResultsForSearch = 7;\n    select2Config.dropdownAutoWidth = true;\n});\n```\n\n## License \n\n    (The MIT License)\n\n    Copyright (C) 2013-2015 by Ruben Vermeersch \u003cruben@rocketeer.be\u003e\n\n    Permission is hereby granted, free of charge, to any person obtaining a copy\n    of this software and associated documentation files (the \"Software\"), to deal\n    in the Software without restriction, including without limitation the rights\n    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n    copies of the Software, and to permit persons to whom the Software is\n    furnished to do so, subject to the following conditions:\n\n    The above copyright notice and this permission notice shall be included in\n    all copies or substantial portions of the Software.\n\n    THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n    THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubenv%2Fangular-select2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubenv%2Fangular-select2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubenv%2Fangular-select2/lists"}