{"action":"created","issue":{"url":"https://api.github.com/repos/indrimuska/angular-selector/issues/23","repository_url":"https://api.github.com/repos/indrimuska/angular-selector","labels_url":"https://api.github.com/repos/indrimuska/angular-selector/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/indrimuska/angular-selector/issues/23/comments","events_url":"https://api.github.com/repos/indrimuska/angular-selector/issues/23/events","html_url":"https://github.com/indrimuska/angular-selector/issues/23","id":136213830,"number":23,"title":"Clicking 'Add [custom-tag]' in dropdown doesn't work","user":{"login":"kmturley","id":1710493,"avatar_url":"https://avatars.githubusercontent.com/u/1710493?v=3","gravatar_id":"","url":"https://api.github.com/users/kmturley","html_url":"https://github.com/kmturley","followers_url":"https://api.github.com/users/kmturley/followers","following_url":"https://api.github.com/users/kmturley/following{/other_user}","gists_url":"https://api.github.com/users/kmturley/gists{/gist_id}","starred_url":"https://api.github.com/users/kmturley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmturley/subscriptions","organizations_url":"https://api.github.com/users/kmturley/orgs","repos_url":"https://api.github.com/users/kmturley/repos","events_url":"https://api.github.com/users/kmturley/events{/privacy}","received_events_url":"https://api.github.com/users/kmturley/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/indrimuska/angular-selector/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-24T22:55:28Z","updated_at":"2016-02-25T00:50:43Z","closed_at":null,"body":"Where we added the new custom tag stuff it doesn't allowed you to click the custom tag to add it:\r\n\r\n    '<li class=\"selector-option active\" ng-if=\"filteredOptions.length == 0\">' +\r\n        'Add <i ng-bind=\"search\"></i>' +\r\n    '</li>' +\r\n\r\nSuggest you modify to be:\r\n\r\n    '<li class=\"selector-option active\" ng-if=\"filteredOptions.length == 0\" ng-mouseover=\"highlight(index)\" ng-click=\"addCustom(search)\">' +\r\n        'Add <i ng-bind=\"search\"></i>' +\r\n    '</li>' +\r\n\r\nAnd add the function to scope:\r\n\r\n    scope.addCustom = function (val) {\r\n        if (val) {\r\n            var option = {};\r\n            if (typeof attrs.create === 'function') {\r\n                option = scope.create({ input: val });\r\n            } else {\r\n                option[scope.labelAttr] = val;\r\n                option[scope.valueAttr || 'value'] = val;\r\n            }\r\n            scope.options.push(option);\r\n            scope.set(option);\r\n        }\r\n    };\r\n\r\nWhich can be reused here too:\r\n\r\n    case KEYS.enter:\r\n    case KEYS.comma:\r\n        if (scope.isOpen) {\r\n            if (scope.filteredOptions.length) {\r\n                scope.set();\r\n            } else if (attrs.create) {\r\n                scope.addCustom(e.target.value);\r\n            }\r\n            e.preventDefault();\r\n        }\r\n        break;"},"comment":{"url":"https://api.github.com/repos/indrimuska/angular-selector/issues/comments/188538538","html_url":"https://github.com/indrimuska/angular-selector/issues/23#issuecomment-188538538","issue_url":"https://api.github.com/repos/indrimuska/angular-selector/issues/23","id":188538538,"user":{"login":"indrimuska","id":1561134,"avatar_url":"https://avatars.githubusercontent.com/u/1561134?v=3","gravatar_id":"","url":"https://api.github.com/users/indrimuska","html_url":"https://github.com/indrimuska","followers_url":"https://api.github.com/users/indrimuska/followers","following_url":"https://api.github.com/users/indrimuska/following{/other_user}","gists_url":"https://api.github.com/users/indrimuska/gists{/gist_id}","starred_url":"https://api.github.com/users/indrimuska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indrimuska/subscriptions","organizations_url":"https://api.github.com/users/indrimuska/orgs","repos_url":"https://api.github.com/users/indrimuska/repos","events_url":"https://api.github.com/users/indrimuska/events{/privacy}","received_events_url":"https://api.github.com/users/indrimuska/received_events","type":"User","site_admin":false},"created_at":"2016-02-25T00:50:43Z","updated_at":"2016-02-25T00:50:43Z","body":"Hey @kmturley, another nice contribution!\r\nThank you for this, give me 5 to add this feature."}}