{"action":"created","issue":{"url":"https://api.github.com/repos/emberjs/rfcs/issues/105","repository_url":"https://api.github.com/repos/emberjs/rfcs","labels_url":"https://api.github.com/repos/emberjs/rfcs/issues/105/labels{/name}","comments_url":"https://api.github.com/repos/emberjs/rfcs/issues/105/comments","events_url":"https://api.github.com/repos/emberjs/rfcs/issues/105/events","html_url":"https://github.com/emberjs/rfcs/issues/105","id":116466722,"number":105,"title":"Have link-to helper and action cooperate by closing on transitions.","user":{"login":"spectras","id":5879675,"avatar_url":"https://avatars.githubusercontent.com/u/5879675?v=3","gravatar_id":"","url":"https://api.github.com/users/spectras","html_url":"https://github.com/spectras","followers_url":"https://api.github.com/users/spectras/followers","following_url":"https://api.github.com/users/spectras/following{/other_user}","gists_url":"https://api.github.com/users/spectras/gists{/gist_id}","starred_url":"https://api.github.com/users/spectras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spectras/subscriptions","organizations_url":"https://api.github.com/users/spectras/orgs","repos_url":"https://api.github.com/users/spectras/repos","events_url":"https://api.github.com/users/spectras/events{/privacy}","received_events_url":"https://api.github.com/users/spectras/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-11-12T02:31:48Z","updated_at":"2016-04-15T11:19:44Z","closed_at":null,"body":"I have been looking around a lot and could not find anything, sorry if I just missed it.\r\n\r\nNow we have the ability to create closure actions with the `{{action}}` helper and pass actions to be invoked by a component, it opens a wide array of possibilites. For instance, we can let a component display some data, and pass it a closure action it will trigger when the user clicks on something.\r\n\r\n```hbs\r\n{{my-list data=library.books nameClicked=(action \"selectBook\") }}\r\n```\r\n```hbs\r\n<ul>{{#each books as |book|~}}\r\n    <li><button {{action attrs.nameClicked book}}>{{book.name}}</button></li>\r\n{{~/each}}</ul>\r\n```\r\nThat example does not actually close over anything but the handler, but that is enough. This is very powerful when cascading sub-components, saving the hassle of forwarding actions on the way up.\r\n\r\nI believe **it would be useful to allow passing a transition as an action this way**. That is:\r\n```hbs\r\n{{my-list data=library.books nameClicked=(link-to 'library.book.edit' library) }}\r\n```\r\nExact syntax could vary. Maybe it could even be another helper instead of `link-to`.\r\n\r\nSo, more to the point, I believe it would be useful to be able to build a callable action that, when triggered, will initiate a transition.\r\n\r\n* Route name is mandatory.\r\n* Additional link-to parameters are closed over (in the example, `library` is closed over).\r\n* Parameters passed when sending the action are appended (in the example, `book` is appended, so transition will have both `library` and `book`).\r\n\r\nThis behavior can be obtained right now by making an action on the controller that invokes `transitionTo`, but that's a bit clumsy."},"comment":{"url":"https://api.github.com/repos/emberjs/rfcs/issues/comments/210422140","html_url":"https://github.com/emberjs/rfcs/issues/105#issuecomment-210422140","issue_url":"https://api.github.com/repos/emberjs/rfcs/issues/105","id":210422140,"user":{"login":"locks","id":32344,"avatar_url":"https://avatars.githubusercontent.com/u/32344?v=3","gravatar_id":"","url":"https://api.github.com/users/locks","html_url":"https://github.com/locks","followers_url":"https://api.github.com/users/locks/followers","following_url":"https://api.github.com/users/locks/following{/other_user}","gists_url":"https://api.github.com/users/locks/gists{/gist_id}","starred_url":"https://api.github.com/users/locks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/locks/subscriptions","organizations_url":"https://api.github.com/users/locks/orgs","repos_url":"https://api.github.com/users/locks/repos","events_url":"https://api.github.com/users/locks/events{/privacy}","received_events_url":"https://api.github.com/users/locks/received_events","type":"User","site_admin":false},"created_at":"2016-04-15T11:19:44Z","updated_at":"2016-04-15T11:19:44Z","body":"@vitch that it is. It is currently being implemented mainly by rwjblue. See https://github.com/rwjblue/ember.js/tree/router-service."}}