Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for select2 tags (dynamically adding new options) #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
290 changes: 0 additions & 290 deletions dist/angular-select2.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/angular-select2.min.js

This file was deleted.

7 changes: 7 additions & 0 deletions src/select2.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,13 @@ angular.module("rt.select2", [])
element.on("change", function (e) {
scope.$apply(function () {
var val;

// if a value was added by select2, we have to add it to our objects dictionary too
if (e.added && !optionItems[e.added.id]) {
e.added.obj = e.added.id;
optionItems[e.added.id] = e.added;
}

if (isMultiple) {
var vals = [];
for (var i = 0; i < e.val.length; i++) {
Expand Down