{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/462","labels_url":"https://api.github.com/repos/angular/angular/issues/462/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/462/comments","events_url":"https://api.github.com/repos/angular/angular/issues/462/events","html_url":"https://github.com/angular/angular/issues/462","id":55268429,"number":462,"title":"[Question] Horizontal visibility for directive injection","user":{"login":"mlaval","id":2316643,"avatar_url":"https://avatars.githubusercontent.com/u/2316643?v=3","gravatar_id":"","url":"https://api.github.com/users/mlaval","html_url":"https://github.com/mlaval","followers_url":"https://api.github.com/users/mlaval/followers","following_url":"https://api.github.com/users/mlaval/following{/other_user}","gists_url":"https://api.github.com/users/mlaval/gists{/gist_id}","starred_url":"https://api.github.com/users/mlaval/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlaval/subscriptions","organizations_url":"https://api.github.com/users/mlaval/orgs","repos_url":"https://api.github.com/users/mlaval/repos","events_url":"https://api.github.com/users/mlaval/events{/privacy}","received_events_url":"https://api.github.com/users/mlaval/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular/labels/%23di","name":"#di","color":"bfdadc"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/angular/angular/milestones/9","labels_url":"https://api.github.com/repos/angular/angular/milestones/9/labels","id":853656,"number":9,"title":"RFC / Discussion","description":"","creator":{"login":"naomiblack","id":2286589,"avatar_url":"https://avatars.githubusercontent.com/u/2286589?v=3","gravatar_id":"","url":"https://api.github.com/users/naomiblack","html_url":"https://github.com/naomiblack","followers_url":"https://api.github.com/users/naomiblack/followers","following_url":"https://api.github.com/users/naomiblack/following{/other_user}","gists_url":"https://api.github.com/users/naomiblack/gists{/gist_id}","starred_url":"https://api.github.com/users/naomiblack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naomiblack/subscriptions","organizations_url":"https://api.github.com/users/naomiblack/orgs","repos_url":"https://api.github.com/users/naomiblack/repos","events_url":"https://api.github.com/users/naomiblack/events{/privacy}","received_events_url":"https://api.github.com/users/naomiblack/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":1,"state":"open","created_at":"2014-11-04T22:06:36Z","updated_at":"2015-01-23T18:36:17Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-01-23T10:48:40Z","updated_at":"2015-01-27T18:31:46Z","closed_at":null,"body":"In the documentation, the visibility constraints specified are all vertical (@ancestor, @parent, @child and @descendant).\r\nWhat about horizontal ones please? Have they been considered ?\r\n\r\nI'm raising this question because, for me, it would quite quite natural and elegant to write something like this in a template:\r\n```\r\n<div>\r\n    <template [ng-if]=\"booleanCondition\"><copy-me>hello2</copy-me></template>\r\n    <template [ng-else]><copy-me>helloElse</copy-me></template>\r\n</div>\r\n```\r\nor\r\n```\r\n<div>\r\n    <copy-me template=\"ng-if booleanCondition\">hello2</copy-me>\r\n    <copy-me template=\"ng-else\">helloElse</copy-me>\r\n</div>\r\n```\r\n\r\nTo implement such a `ng-else` directive, a visibility constraint like @previous or @before is needed.\r\nMore generally, it seems a good idea to be able to link sibling directives without having to create an extra parent directive.\r\nWhat do you think please ?\r\n\r\nFor information, I did quick and dirty implementation of `ng-else` to find out how it could be done: https://github.com/mlaval/angular/commit/df56d40ef1589cb8f14c97e3f61ec3ca956a08f1\r\nBefore moving forward and implementing that in a cleaner way, I wanted to discuss it with you."},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/71701000","html_url":"https://github.com/angular/angular/issues/462#issuecomment-71701000","issue_url":"https://api.github.com/repos/angular/angular/issues/462","id":71701000,"user":{"login":"mlaval","id":2316643,"avatar_url":"https://avatars.githubusercontent.com/u/2316643?v=3","gravatar_id":"","url":"https://api.github.com/users/mlaval","html_url":"https://github.com/mlaval","followers_url":"https://api.github.com/users/mlaval/followers","following_url":"https://api.github.com/users/mlaval/following{/other_user}","gists_url":"https://api.github.com/users/mlaval/gists{/gist_id}","starred_url":"https://api.github.com/users/mlaval/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlaval/subscriptions","organizations_url":"https://api.github.com/users/mlaval/orgs","repos_url":"https://api.github.com/users/mlaval/repos","events_url":"https://api.github.com/users/mlaval/events{/privacy}","received_events_url":"https://api.github.com/users/mlaval/received_events","type":"User","site_admin":false},"created_at":"2015-01-27T18:31:46Z","updated_at":"2015-01-27T18:31:46Z","body":"To translate the vertical ones with the same spirit, I would create @Before, @Previous, @Next and @After.\r\n- @Previous and @Next would only inject a directive from the very previous/next element (not considering comment nodes in between)\r\n- @Before and @After would inject a directive from any element before/after.\r\nFor sure, the elements created by the `ViewSplitter` should not interfere.\r\n\r\nWhat do you think?"}}