{"action":"created","issue":{"url":"https://api.github.com/repos/indrimuska/angular-selector/issues/11","labels_url":"https://api.github.com/repos/indrimuska/angular-selector/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/indrimuska/angular-selector/issues/11/comments","events_url":"https://api.github.com/repos/indrimuska/angular-selector/issues/11/events","html_url":"https://github.com/indrimuska/angular-selector/pull/11","id":126803161,"number":11,"title":"Add option to allow user inputted tags","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":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2016-01-15T03:54:09Z","updated_at":"2016-01-31T22:23:35Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/indrimuska/angular-selector/pulls/11","html_url":"https://github.com/indrimuska/angular-selector/pull/11","diff_url":"https://github.com/indrimuska/angular-selector/pull/11.diff","patch_url":"https://github.com/indrimuska/angular-selector/pull/11.patch"},"body":"Option which allows the user to type in their own tags and hit ‘Enter’ to add them to the list available. Add user=“true” to enable this feature\r\n\r\n    <select selector multi=\"true\" user=\"true\" class=\"jumbotron-selector\">\r\n\r\nOriginal feature request ticket:\r\nhttps://github.com/indrimuska/angular-selector/issues/10"},"comment":{"url":"https://api.github.com/repos/indrimuska/angular-selector/issues/comments/177637697","html_url":"https://github.com/indrimuska/angular-selector/pull/11#issuecomment-177637697","issue_url":"https://api.github.com/repos/indrimuska/angular-selector/issues/11","id":177637697,"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},"created_at":"2016-01-31T22:23:35Z","updated_at":"2016-01-31T22:23:35Z","body":"In your example you are presuming the server renders the html, which means you can output the selected attribute:\r\n\r\n    <option value=\"item2\" selected>Item 2</option>\r\n\r\nIn my version i'm using them differently:\r\n- options, only in static html, show possible dropdown options, everyone shares/sees these\r\n- model, as json object, the items this specific user has selected (I load these via ajax, and save via ajax)\r\n\r\nExample:\r\nUser A goes onto the form, select from a list of favourite hobbies:\r\noptions = Fishing, Soccer, Music\r\nmodel = []\r\n\r\nThey select Soccer and then a second custom tag: Skydiving\r\noptions = Fishing, Soccer, Music\r\nmodel = [Soccer, Skydiving]\r\n\r\nThe model is saved to the server. User B visits the site and should not see Skydiving, just the original options:\r\noptions = Fishing, Soccer, Music\r\nmodel = [Fishing]\r\n\r\nIf User A returns to the site, I load the ajax feed and populate the model:\r\noptions = Fishing, Soccer, Music\r\nmodel = [Soccer, Skydiving]\r\n\r\nSkydiving tag is NOT shown in your example, because the tag in the model does not match the item in the options. in my version the tag is allowed to be visible using:\r\n\r\n    var inList = $filter('filter')(scope.options, function (option) {\r\n        return scope.optionEquals(option, value);\r\n    })[0];\r\n    return scope.create ? value : inList;\r\n\r\nAdditionally. I found a bug if you use:\r\n\r\n    create:                '@?',\r\n\r\nand then:\r\n\r\n    create=\"true\"\r\n\r\nthen this next statement does not work, it passes through true:\r\n\r\n    angular.isFunction(scope.create)\r\n\r\nBut if you use:\r\n\r\n\tcreate:                '=?',\r\n\r\nIt works. If you test the plugin using label/value objects and create=\"true\", you should be able to see the issue! I put that example in my previous plunkr:\r\nhttp://plnkr.co/edit/HChqis9aT8yydMEnf9kF?p=preview\r\n\r\n"}}