{"action":"created","issue":{"url":"https://api.github.com/repos/vuejs/Discussion/issues/210","labels_url":"https://api.github.com/repos/vuejs/Discussion/issues/210/labels{/name}","comments_url":"https://api.github.com/repos/vuejs/Discussion/issues/210/comments","events_url":"https://api.github.com/repos/vuejs/Discussion/issues/210/events","html_url":"https://github.com/vuejs/Discussion/issues/210","id":89815720,"number":210,"title":"Filter v-repeat by select element value","user":{"login":"stell","id":701298,"avatar_url":"https://avatars.githubusercontent.com/u/701298?v=3","gravatar_id":"","url":"https://api.github.com/users/stell","html_url":"https://github.com/stell","followers_url":"https://api.github.com/users/stell/followers","following_url":"https://api.github.com/users/stell/following{/other_user}","gists_url":"https://api.github.com/users/stell/gists{/gist_id}","starred_url":"https://api.github.com/users/stell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stell/subscriptions","organizations_url":"https://api.github.com/users/stell/orgs","repos_url":"https://api.github.com/users/stell/repos","events_url":"https://api.github.com/users/stell/events{/privacy}","received_events_url":"https://api.github.com/users/stell/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-20T20:40:20Z","updated_at":"2015-06-21T14:38:26Z","closed_at":null,"body":"I am trying to filter a v-repeat by the value selected in an input.\r\nThe example below works, but how can i set the searchterm dynamically to the option value selected?\r\n\r\nThis is not working:\r\n\r\n    <select v-on=\"change: searchterm = this.value\">\r\n\r\n\r\nThis works, but the searchterm value is not dynamic.\r\n\r\n```\r\nVue.filter('search', function (array, search)\r\n\t{\r\n      return array.filter(function (item) {\r\n\t     return item.type.toLowerCase().indexOf(search) > -1;\r\n\t  })\r\n\t});\r\n\r\n\tvar app = new Vue({\r\n\t  el: '#app',\r\n\t  data: {\r\n\t    title: 'Logs',\r\n\t    limitcount: 20,\r\n\t    searchterm: 'pdf',\r\n\t    logs: [\r\n\t      { status: true,        type: 'import',        desc: 'Learn JavaScript',        date: '11.11.2015',        id: 1  },\r\n\t      { status: true,        type: 'pdf',        desc: 'Learn JavaScript',        date: '11.11.2015',        id: 2  }\r\n\t    ]\r\n\t  }\r\n\t})\r\n```\r\n\r\n\r\n```\r\n<select v-on=\"change: searchterm = \\'import\\'\">\r\n\t<option value=\"\" selected=\"selected\"></option>\r\n\t<option value=\"pdf\">PDF</option>\r\n\t<option value=\"import\">Import</option>\r\n</select>\r\n```\r\n\r\n```\r\n<table>\r\n\t\t<tbody>\r\n\t\t\t<tr v-repeat=\"logs | search searchterm | limit limitcount\" >\r\n\t\t\t\t<td>{{status}}</td>\r\n\t\t\t\t<td>{{type}}</td>\r\n\t\t\t\t<td>{{desc}}</td>\r\n\t\t\t\t<td>{{stamp}}</td>\r\n\t\t\t\t<td>{{id}}</td>\r\n\t\t\t</tr>\r\n\t\t</tbody>\r\n\t</table>\r\n```"},"comment":{"url":"https://api.github.com/repos/vuejs/Discussion/issues/comments/113909734","html_url":"https://github.com/vuejs/Discussion/issues/210#issuecomment-113909734","issue_url":"https://api.github.com/repos/vuejs/Discussion/issues/210","id":113909734,"user":{"login":"stell","id":701298,"avatar_url":"https://avatars.githubusercontent.com/u/701298?v=3","gravatar_id":"","url":"https://api.github.com/users/stell","html_url":"https://github.com/stell","followers_url":"https://api.github.com/users/stell/followers","following_url":"https://api.github.com/users/stell/following{/other_user}","gists_url":"https://api.github.com/users/stell/gists{/gist_id}","starred_url":"https://api.github.com/users/stell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stell/subscriptions","organizations_url":"https://api.github.com/users/stell/orgs","repos_url":"https://api.github.com/users/stell/repos","events_url":"https://api.github.com/users/stell/events{/privacy}","received_events_url":"https://api.github.com/users/stell/received_events","type":"User","site_admin":false},"created_at":"2015-06-21T14:38:26Z","updated_at":"2015-06-21T14:38:26Z","body":"OK thanks, but when i do something like this:\r\n\r\n    <select v-model=\"searchterm\" options=\"logs.type\">\r\n\r\nhow can i set the options to a distinct array of log types?\r\n\r\nDoing it staticaly works:\r\n\r\n    types: ['hit', 'import'],\r\n\r\nBut dynamic:\r\n\r\n    var types= logs.filter(function(item, i, ar){ return ar.indexOf(item) === i; });\r\n\r\nHow to use that with the v-model options?\r\n"}}