{"action":"created","comment":{"url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/pulls/comments/31315845","id":31315845,"diff_hunk":"@@ -0,0 +1,82 @@\n+(function () {\n+  'use strict';\n+\n+  /**\n+   * `permutation-switch`\n+   *\n+   * This provides an expression to be evaluated by child predicate permutations\n+   */\n+  function PermutationSwitchDirective ($parse) {\n+    return {\n+      restrict: 'AE',\n+      require: 'permutationSwitch',\n+      priority: 500,\n+      controller: ['$scope', function NgPermutationSwitchCtrl () {\n+        this.permutations = [];\n+\n+        this.addPermutation = function (permutation) {\n+          this.permutations.push(permutation);\n+        };\n+      }],\n+      link: function (scope, element, attrs, permutationSwitchController) {\n+        var watchExpression = attrs.permutationSwitch || attrs.on,\n+            selectedPermutations = [];\n+\n+        // re-evaluate which transclusions to display when the main expression changes\n+        scope.$watch(watchExpression, function permutationSwitchWatchAction (value) {\n+          var selectedPermutation;\n+\n+          // destroy existing transcluded scopes and elements\n+          while (selectedPermutations.length > 0) {\n+            selectedPermutation = selectedPermutations.pop();\n+            selectedPermutation.scope.$destroy();\n+            selectedPermutation.element.remove();\n+          }\n+\n+          // examine each child predicate and transclude the ones that come out truthy\n+          angular.forEach(permutationSwitchController.permutations, function (selectedTransclude) {\n+            var predicate = $parse(selectedTransclude.expression)(scope);","path":"src/permutation-switch.js","position":38,"original_position":38,"commit_id":"f5c7493ed25accdf0701fc564b40862e66a763cf","original_commit_id":"f5c7493ed25accdf0701fc564b40862e66a763cf","user":{"login":"ajwhite","id":656630,"avatar_url":"https://avatars.githubusercontent.com/u/656630?v=3","gravatar_id":"","url":"https://api.github.com/users/ajwhite","html_url":"https://github.com/ajwhite","followers_url":"https://api.github.com/users/ajwhite/followers","following_url":"https://api.github.com/users/ajwhite/following{/other_user}","gists_url":"https://api.github.com/users/ajwhite/gists{/gist_id}","starred_url":"https://api.github.com/users/ajwhite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajwhite/subscriptions","organizations_url":"https://api.github.com/users/ajwhite/orgs","repos_url":"https://api.github.com/users/ajwhite/repos","events_url":"https://api.github.com/users/ajwhite/events{/privacy}","received_events_url":"https://api.github.com/users/ajwhite/received_events","type":"User","site_admin":false},"body":"Scope is only isolated on the directive if you define scope properties, otherwise it shares it ","created_at":"2015-05-29T11:10:55Z","updated_at":"2015-05-29T11:10:55Z","html_url":"https://github.com/ajwhite/angular-permutation-switch/pull/1#discussion_r31315845","pull_request_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/ajwhite/angular-permutation-switch/pulls/comments/31315845"},"html":{"href":"https://github.com/ajwhite/angular-permutation-switch/pull/1#discussion_r31315845"},"pull_request":{"href":"https://api.github.com/repos/ajwhite/angular-permutation-switch/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/pulls/1","id":36472798,"html_url":"https://github.com/ajwhite/angular-permutation-switch/pull/1","diff_url":"https://github.com/ajwhite/angular-permutation-switch/pull/1.diff","patch_url":"https://github.com/ajwhite/angular-permutation-switch/pull/1.patch","issue_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/issues/1","number":1,"state":"open","locked":false,"title":"Permutation switch directive","user":{"login":"ajwhite","id":656630,"avatar_url":"https://avatars.githubusercontent.com/u/656630?v=3","gravatar_id":"","url":"https://api.github.com/users/ajwhite","html_url":"https://github.com/ajwhite","followers_url":"https://api.github.com/users/ajwhite/followers","following_url":"https://api.github.com/users/ajwhite/following{/other_user}","gists_url":"https://api.github.com/users/ajwhite/gists{/gist_id}","starred_url":"https://api.github.com/users/ajwhite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajwhite/subscriptions","organizations_url":"https://api.github.com/users/ajwhite/orgs","repos_url":"https://api.github.com/users/ajwhite/repos","events_url":"https://api.github.com/users/ajwhite/events{/privacy}","received_events_url":"https://api.github.com/users/ajwhite/received_events","type":"User","site_admin":false},"body":"Initial implementation of the enhanced switch.\r\n\r\nExamples and usages are in the [readme](https://github.com/ajwhite/angular-permutation-switch/blob/develop/README.md) included in this PR.\r\n\r\nBuild tasks and travis will be introduced in a later PR (jscs, jslint, tests, minifiers, etc)","created_at":"2015-05-29T04:13:11Z","updated_at":"2015-05-29T11:10:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"22265906c37bb2e2ef2351c55a547f739bfc2ab9","assignee":{"login":"jutaz","id":1277553,"avatar_url":"https://avatars.githubusercontent.com/u/1277553?v=3","gravatar_id":"","url":"https://api.github.com/users/jutaz","html_url":"https://github.com/jutaz","followers_url":"https://api.github.com/users/jutaz/followers","following_url":"https://api.github.com/users/jutaz/following{/other_user}","gists_url":"https://api.github.com/users/jutaz/gists{/gist_id}","starred_url":"https://api.github.com/users/jutaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jutaz/subscriptions","organizations_url":"https://api.github.com/users/jutaz/orgs","repos_url":"https://api.github.com/users/jutaz/repos","events_url":"https://api.github.com/users/jutaz/events{/privacy}","received_events_url":"https://api.github.com/users/jutaz/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/pulls/1/commits","review_comments_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/pulls/1/comments","review_comment_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/issues/1/comments","statuses_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/statuses/f5c7493ed25accdf0701fc564b40862e66a763cf","head":{"label":"ajwhite:develop","ref":"develop","sha":"f5c7493ed25accdf0701fc564b40862e66a763cf","user":{"login":"ajwhite","id":656630,"avatar_url":"https://avatars.githubusercontent.com/u/656630?v=3","gravatar_id":"","url":"https://api.github.com/users/ajwhite","html_url":"https://github.com/ajwhite","followers_url":"https://api.github.com/users/ajwhite/followers","following_url":"https://api.github.com/users/ajwhite/following{/other_user}","gists_url":"https://api.github.com/users/ajwhite/gists{/gist_id}","starred_url":"https://api.github.com/users/ajwhite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajwhite/subscriptions","organizations_url":"https://api.github.com/users/ajwhite/orgs","repos_url":"https://api.github.com/users/ajwhite/repos","events_url":"https://api.github.com/users/ajwhite/events{/privacy}","received_events_url":"https://api.github.com/users/ajwhite/received_events","type":"User","site_admin":false},"repo":{"id":36460270,"name":"angular-permutation-switch","full_name":"ajwhite/angular-permutation-switch","owner":{"login":"ajwhite","id":656630,"avatar_url":"https://avatars.githubusercontent.com/u/656630?v=3","gravatar_id":"","url":"https://api.github.com/users/ajwhite","html_url":"https://github.com/ajwhite","followers_url":"https://api.github.com/users/ajwhite/followers","following_url":"https://api.github.com/users/ajwhite/following{/other_user}","gists_url":"https://api.github.com/users/ajwhite/gists{/gist_id}","starred_url":"https://api.github.com/users/ajwhite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajwhite/subscriptions","organizations_url":"https://api.github.com/users/ajwhite/orgs","repos_url":"https://api.github.com/users/ajwhite/repos","events_url":"https://api.github.com/users/ajwhite/events{/privacy}","received_events_url":"https://api.github.com/users/ajwhite/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ajwhite/angular-permutation-switch","description":"An enhanced ng-switch and ng-message directive","fork":false,"url":"https://api.github.com/repos/ajwhite/angular-permutation-switch","forks_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/forks","keys_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/teams","hooks_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/hooks","issue_events_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/issues/events{/number}","events_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/events","assignees_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/assignees{/user}","branches_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/branches{/branch}","tags_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/tags","blobs_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/git/refs{/sha}","trees_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/statuses/{sha}","languages_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/languages","stargazers_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/stargazers","contributors_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/contributors","subscribers_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/subscribers","subscription_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/subscription","commits_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/commits{/sha}","git_commits_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/git/commits{/sha}","comments_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/comments{/number}","issue_comment_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/issues/comments{/number}","contents_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/contents/{+path}","compare_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/merges","archive_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/downloads","issues_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/issues{/number}","pulls_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/pulls{/number}","milestones_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/milestones{/number}","notifications_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/labels{/name}","releases_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/releases{/id}","created_at":"2015-05-28T19:12:14Z","updated_at":"2015-05-28T20:07:03Z","pushed_at":"2015-05-29T04:19:02Z","git_url":"git://github.com/ajwhite/angular-permutation-switch.git","ssh_url":"git@github.com:ajwhite/angular-permutation-switch.git","clone_url":"https://github.com/ajwhite/angular-permutation-switch.git","svn_url":"https://github.com/ajwhite/angular-permutation-switch","homepage":"","size":0,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"ajwhite:master","ref":"master","sha":"cf80b25006686b42b63c0d94f9b0ce33c7517b97","user":{"login":"ajwhite","id":656630,"avatar_url":"https://avatars.githubusercontent.com/u/656630?v=3","gravatar_id":"","url":"https://api.github.com/users/ajwhite","html_url":"https://github.com/ajwhite","followers_url":"https://api.github.com/users/ajwhite/followers","following_url":"https://api.github.com/users/ajwhite/following{/other_user}","gists_url":"https://api.github.com/users/ajwhite/gists{/gist_id}","starred_url":"https://api.github.com/users/ajwhite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajwhite/subscriptions","organizations_url":"https://api.github.com/users/ajwhite/orgs","repos_url":"https://api.github.com/users/ajwhite/repos","events_url":"https://api.github.com/users/ajwhite/events{/privacy}","received_events_url":"https://api.github.com/users/ajwhite/received_events","type":"User","site_admin":false},"repo":{"id":36460270,"name":"angular-permutation-switch","full_name":"ajwhite/angular-permutation-switch","owner":{"login":"ajwhite","id":656630,"avatar_url":"https://avatars.githubusercontent.com/u/656630?v=3","gravatar_id":"","url":"https://api.github.com/users/ajwhite","html_url":"https://github.com/ajwhite","followers_url":"https://api.github.com/users/ajwhite/followers","following_url":"https://api.github.com/users/ajwhite/following{/other_user}","gists_url":"https://api.github.com/users/ajwhite/gists{/gist_id}","starred_url":"https://api.github.com/users/ajwhite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajwhite/subscriptions","organizations_url":"https://api.github.com/users/ajwhite/orgs","repos_url":"https://api.github.com/users/ajwhite/repos","events_url":"https://api.github.com/users/ajwhite/events{/privacy}","received_events_url":"https://api.github.com/users/ajwhite/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ajwhite/angular-permutation-switch","description":"An enhanced ng-switch and ng-message directive","fork":false,"url":"https://api.github.com/repos/ajwhite/angular-permutation-switch","forks_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/forks","keys_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/teams","hooks_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/hooks","issue_events_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/issues/events{/number}","events_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/events","assignees_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/assignees{/user}","branches_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/branches{/branch}","tags_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/tags","blobs_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/git/refs{/sha}","trees_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/statuses/{sha}","languages_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/languages","stargazers_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/stargazers","contributors_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/contributors","subscribers_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/subscribers","subscription_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/subscription","commits_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/commits{/sha}","git_commits_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/git/commits{/sha}","comments_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/comments{/number}","issue_comment_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/issues/comments{/number}","contents_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/contents/{+path}","compare_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/merges","archive_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/downloads","issues_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/issues{/number}","pulls_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/pulls{/number}","milestones_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/milestones{/number}","notifications_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/labels{/name}","releases_url":"https://api.github.com/repos/ajwhite/angular-permutation-switch/releases{/id}","created_at":"2015-05-28T19:12:14Z","updated_at":"2015-05-28T20:07:03Z","pushed_at":"2015-05-29T04:19:02Z","git_url":"git://github.com/ajwhite/angular-permutation-switch.git","ssh_url":"git@github.com:ajwhite/angular-permutation-switch.git","clone_url":"https://github.com/ajwhite/angular-permutation-switch.git","svn_url":"https://github.com/ajwhite/angular-permutation-switch","homepage":"","size":0,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/ajwhite/angular-permutation-switch/pulls/1"},"html":{"href":"https://github.com/ajwhite/angular-permutation-switch/pull/1"},"issue":{"href":"https://api.github.com/repos/ajwhite/angular-permutation-switch/issues/1"},"comments":{"href":"https://api.github.com/repos/ajwhite/angular-permutation-switch/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/ajwhite/angular-permutation-switch/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/ajwhite/angular-permutation-switch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ajwhite/angular-permutation-switch/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/ajwhite/angular-permutation-switch/statuses/f5c7493ed25accdf0701fc564b40862e66a763cf"}}}}