{"action":"closed","issue":{"url":"https://api.github.com/repos/yyx990803/vue/issues/722","labels_url":"https://api.github.com/repos/yyx990803/vue/issues/722/labels{/name}","comments_url":"https://api.github.com/repos/yyx990803/vue/issues/722/comments","events_url":"https://api.github.com/repos/yyx990803/vue/issues/722/events","html_url":"https://github.com/yyx990803/vue/issues/722","id":58496102,"number":722,"title":"Support callback parameters","user":{"login":"jcoffland","id":1166284,"avatar_url":"https://avatars.githubusercontent.com/u/1166284?v=3","gravatar_id":"","url":"https://api.github.com/users/jcoffland","html_url":"https://github.com/jcoffland","followers_url":"https://api.github.com/users/jcoffland/followers","following_url":"https://api.github.com/users/jcoffland/following{/other_user}","gists_url":"https://api.github.com/users/jcoffland/gists{/gist_id}","starred_url":"https://api.github.com/users/jcoffland/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcoffland/subscriptions","organizations_url":"https://api.github.com/users/jcoffland/orgs","repos_url":"https://api.github.com/users/jcoffland/repos","events_url":"https://api.github.com/users/jcoffland/events{/privacy}","received_events_url":"https://api.github.com/users/jcoffland/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/yyx990803/vue/labels/suggestion","name":"suggestion","color":"fad8c7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":30,"created_at":"2015-02-22T09:02:17Z","updated_at":"2015-06-08T17:59:45Z","closed_at":"2015-06-08T17:59:45Z","body":"I understand that it's possible to communicate between parent and child components via events but it would be very convenient if vue.js supported what I'm calling *callback attributes*.  This would allow you to write HTML something like this:\r\n\r\n```\r\n<parent-component>\r\n  <child-component on-callback=\"doSomething\">\r\n  </child-component>\r\n</parent-component>\r\n```\r\n\r\nWith Javascript code like this:\r\n\r\n```\r\nvar parent = {\r\n  methods: {\r\n    doSomething: function (args) {\r\n      // Do something\r\n    }\r\n  }\r\n}\r\n\r\nvar child = {\r\n  cbAttributes: ['on-callback'],\r\n\r\n  ready: function () {\r\n    this.onCallback(/* Args */);\r\n  }\r\n}\r\n\r\n$(function () {\r\n  new Vue({\r\n    el: 'body',\r\n\r\n    components: {\r\n      'parent-component': parent,\r\n      'child-component': child,\r\n    }\r\n  }\r\n})\r\n```\r\n\r\nCurrently, I can fake this using ```paramAttributes``` by passing the function name as a string and then calling the function from the child like this:\r\n\r\n```\r\nthis.$parent[this.onCallback](/* args */);\r\n```\r\n\r\nbut it would be much nicer if this was explicitly supported.\r\n\r\nI've tried passing callbacks as ```paramAttributes``` like this:\r\n\r\n```\r\n<parent-component>\r\n  <child-component on-callback=\"{{doSomething}}\">\r\n  </child-component>\r\n</parent-component>\r\n```\r\n\r\nbut it does not seem to work.\r\n\r\nAlso, I want to point out that this does not couple the parent and child.\r\n\r\nI searched for similar issues but did not find one.  I apologize in advance if this is a duplicate."}}