{"action":"created","comment":{"url":"https://api.github.com/repos/showpad/angular-colorpicker/pulls/comments/47615470","id":47615470,"diff_hunk":"@@ -0,0 +1,67 @@\n+(function (angular) {\n+    'use strict';\n+\n+    angular\n+        .module('spColorpicker')\n+        .directive('colorpicker', ColorPicker);\n+\n+    /**\n+     * Color picker attribute directive\n+     * @param ColorPickerHelper\n+     * @returns {{retquire: string, restrict: string, controller: ColorPickerController}}\n+     * @constructor\n+     */\n+    function ColorPicker (ColorPickerHelper)\n+    {\n+        return {\n+            restrict: 'AE',\n+            controller: ColorPickerController,\n+            scope: {\n+                ngModel: '=?',\n+                onChange: '=?'\n+            }\n+        };\n+\n+        /**\n+         * Controller for the color picker\n+         * @param {Object} $scope\n+         * @param {Object} $element\n+         * @param {Object} $attrs\n+         * @constructor\n+         */\n+        function ColorPickerController ($scope, $element, $attrs)\n+        {\n+            let thisFormat = ColorPickerHelper.prepareValues($attrs.colorpicker);\n+\n+            $element.colorpicker({ format: thisFormat.name });\n+            $element.colorpicker().on('changeColor', transformChangedColor);\n+            $element.on('blur', updateModel);\n+\n+            ColorPickerHelper.updateView($element, $scope.ngModel);\n+\n+            /**\n+             * Transform the color that got changed\n+             * @param {Object} event\n+             */\n+            function transformChangedColor (event)\n+            {\n+                const newColorValue = $element.data('colorpicker').format(event.color[thisFormat.transform]());","path":"js/src/bootstrap-colorpicker.directive.js","position":48,"original_position":48,"commit_id":"32c0b1aa25d920a79545ef81e508bd5dd035ab02","original_commit_id":"32c0b1aa25d920a79545ef81e508bd5dd035ab02","user":{"login":"klaascuvelier","id":354147,"avatar_url":"https://avatars.githubusercontent.com/u/354147?v=3","gravatar_id":"","url":"https://api.github.com/users/klaascuvelier","html_url":"https://github.com/klaascuvelier","followers_url":"https://api.github.com/users/klaascuvelier/followers","following_url":"https://api.github.com/users/klaascuvelier/following{/other_user}","gists_url":"https://api.github.com/users/klaascuvelier/gists{/gist_id}","starred_url":"https://api.github.com/users/klaascuvelier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klaascuvelier/subscriptions","organizations_url":"https://api.github.com/users/klaascuvelier/orgs","repos_url":"https://api.github.com/users/klaascuvelier/repos","events_url":"https://api.github.com/users/klaascuvelier/events{/privacy}","received_events_url":"https://api.github.com/users/klaascuvelier/received_events","type":"User","site_admin":false},"body":"Can't you store the result of `$element.colorpicker` above into a variable which you reuse here.\r\nDoesn't seem very nice to have to do jquery data events to get the instance of the color picker","created_at":"2015-12-15T09:45:35Z","updated_at":"2015-12-15T09:45:35Z","html_url":"https://github.com/showpad/angular-colorpicker/pull/3#discussion_r47615470","pull_request_url":"https://api.github.com/repos/showpad/angular-colorpicker/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/showpad/angular-colorpicker/pulls/comments/47615470"},"html":{"href":"https://github.com/showpad/angular-colorpicker/pull/3#discussion_r47615470"},"pull_request":{"href":"https://api.github.com/repos/showpad/angular-colorpicker/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/showpad/angular-colorpicker/pulls/3","id":53672671,"html_url":"https://github.com/showpad/angular-colorpicker/pull/3","diff_url":"https://github.com/showpad/angular-colorpicker/pull/3.diff","patch_url":"https://github.com/showpad/angular-colorpicker/pull/3.patch","issue_url":"https://api.github.com/repos/showpad/angular-colorpicker/issues/3","number":3,"state":"open","locked":false,"title":"Sp 4553 cleanup and fix ng model bug","user":{"login":"dejakob","id":5782495,"avatar_url":"https://avatars.githubusercontent.com/u/5782495?v=3","gravatar_id":"","url":"https://api.github.com/users/dejakob","html_url":"https://github.com/dejakob","followers_url":"https://api.github.com/users/dejakob/followers","following_url":"https://api.github.com/users/dejakob/following{/other_user}","gists_url":"https://api.github.com/users/dejakob/gists{/gist_id}","starred_url":"https://api.github.com/users/dejakob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dejakob/subscriptions","organizations_url":"https://api.github.com/users/dejakob/orgs","repos_url":"https://api.github.com/users/dejakob/repos","events_url":"https://api.github.com/users/dejakob/events{/privacy}","received_events_url":"https://api.github.com/users/dejakob/received_events","type":"User","site_admin":false},"body":"http://team.showpad.com:8008/browse/SP-6495\r\nhttp://master.showpad.dev:8080/job/Colorpicker-SP-4553-cleanup-and-fix-ng-model-bug/","created_at":"2015-12-15T08:22:44Z","updated_at":"2015-12-15T09:45:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ebf65786e9782752d35d360052a1269e3e588341","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/showpad/angular-colorpicker/pulls/3/commits","review_comments_url":"https://api.github.com/repos/showpad/angular-colorpicker/pulls/3/comments","review_comment_url":"https://api.github.com/repos/showpad/angular-colorpicker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/showpad/angular-colorpicker/issues/3/comments","statuses_url":"https://api.github.com/repos/showpad/angular-colorpicker/statuses/32c0b1aa25d920a79545ef81e508bd5dd035ab02","head":{"label":"showpad:SP-4553-cleanup-and-fix-ng-model-bug","ref":"SP-4553-cleanup-and-fix-ng-model-bug","sha":"32c0b1aa25d920a79545ef81e508bd5dd035ab02","user":{"login":"showpad","id":2281179,"avatar_url":"https://avatars.githubusercontent.com/u/2281179?v=3","gravatar_id":"","url":"https://api.github.com/users/showpad","html_url":"https://github.com/showpad","followers_url":"https://api.github.com/users/showpad/followers","following_url":"https://api.github.com/users/showpad/following{/other_user}","gists_url":"https://api.github.com/users/showpad/gists{/gist_id}","starred_url":"https://api.github.com/users/showpad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/showpad/subscriptions","organizations_url":"https://api.github.com/users/showpad/orgs","repos_url":"https://api.github.com/users/showpad/repos","events_url":"https://api.github.com/users/showpad/events{/privacy}","received_events_url":"https://api.github.com/users/showpad/received_events","type":"Organization","site_admin":false},"repo":{"id":21271280,"name":"angular-colorpicker","full_name":"showpad/angular-colorpicker","owner":{"login":"showpad","id":2281179,"avatar_url":"https://avatars.githubusercontent.com/u/2281179?v=3","gravatar_id":"","url":"https://api.github.com/users/showpad","html_url":"https://github.com/showpad","followers_url":"https://api.github.com/users/showpad/followers","following_url":"https://api.github.com/users/showpad/following{/other_user}","gists_url":"https://api.github.com/users/showpad/gists{/gist_id}","starred_url":"https://api.github.com/users/showpad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/showpad/subscriptions","organizations_url":"https://api.github.com/users/showpad/orgs","repos_url":"https://api.github.com/users/showpad/repos","events_url":"https://api.github.com/users/showpad/events{/privacy}","received_events_url":"https://api.github.com/users/showpad/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/showpad/angular-colorpicker","description":"","fork":false,"url":"https://api.github.com/repos/showpad/angular-colorpicker","forks_url":"https://api.github.com/repos/showpad/angular-colorpicker/forks","keys_url":"https://api.github.com/repos/showpad/angular-colorpicker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/showpad/angular-colorpicker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/showpad/angular-colorpicker/teams","hooks_url":"https://api.github.com/repos/showpad/angular-colorpicker/hooks","issue_events_url":"https://api.github.com/repos/showpad/angular-colorpicker/issues/events{/number}","events_url":"https://api.github.com/repos/showpad/angular-colorpicker/events","assignees_url":"https://api.github.com/repos/showpad/angular-colorpicker/assignees{/user}","branches_url":"https://api.github.com/repos/showpad/angular-colorpicker/branches{/branch}","tags_url":"https://api.github.com/repos/showpad/angular-colorpicker/tags","blobs_url":"https://api.github.com/repos/showpad/angular-colorpicker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/showpad/angular-colorpicker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/showpad/angular-colorpicker/git/refs{/sha}","trees_url":"https://api.github.com/repos/showpad/angular-colorpicker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/showpad/angular-colorpicker/statuses/{sha}","languages_url":"https://api.github.com/repos/showpad/angular-colorpicker/languages","stargazers_url":"https://api.github.com/repos/showpad/angular-colorpicker/stargazers","contributors_url":"https://api.github.com/repos/showpad/angular-colorpicker/contributors","subscribers_url":"https://api.github.com/repos/showpad/angular-colorpicker/subscribers","subscription_url":"https://api.github.com/repos/showpad/angular-colorpicker/subscription","commits_url":"https://api.github.com/repos/showpad/angular-colorpicker/commits{/sha}","git_commits_url":"https://api.github.com/repos/showpad/angular-colorpicker/git/commits{/sha}","comments_url":"https://api.github.com/repos/showpad/angular-colorpicker/comments{/number}","issue_comment_url":"https://api.github.com/repos/showpad/angular-colorpicker/issues/comments{/number}","contents_url":"https://api.github.com/repos/showpad/angular-colorpicker/contents/{+path}","compare_url":"https://api.github.com/repos/showpad/angular-colorpicker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/showpad/angular-colorpicker/merges","archive_url":"https://api.github.com/repos/showpad/angular-colorpicker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/showpad/angular-colorpicker/downloads","issues_url":"https://api.github.com/repos/showpad/angular-colorpicker/issues{/number}","pulls_url":"https://api.github.com/repos/showpad/angular-colorpicker/pulls{/number}","milestones_url":"https://api.github.com/repos/showpad/angular-colorpicker/milestones{/number}","notifications_url":"https://api.github.com/repos/showpad/angular-colorpicker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/showpad/angular-colorpicker/labels{/name}","releases_url":"https://api.github.com/repos/showpad/angular-colorpicker/releases{/id}","created_at":"2014-06-27T09:50:28Z","updated_at":"2015-04-23T15:37:11Z","pushed_at":"2015-12-15T08:22:44Z","git_url":"git://github.com/showpad/angular-colorpicker.git","ssh_url":"git@github.com:showpad/angular-colorpicker.git","clone_url":"https://github.com/showpad/angular-colorpicker.git","svn_url":"https://github.com/showpad/angular-colorpicker","homepage":null,"size":79,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"showpad:SP-6497-gulp-karma","ref":"SP-6497-gulp-karma","sha":"fbd04327d78170eaca674ba8dddfc4fa99656a99","user":{"login":"showpad","id":2281179,"avatar_url":"https://avatars.githubusercontent.com/u/2281179?v=3","gravatar_id":"","url":"https://api.github.com/users/showpad","html_url":"https://github.com/showpad","followers_url":"https://api.github.com/users/showpad/followers","following_url":"https://api.github.com/users/showpad/following{/other_user}","gists_url":"https://api.github.com/users/showpad/gists{/gist_id}","starred_url":"https://api.github.com/users/showpad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/showpad/subscriptions","organizations_url":"https://api.github.com/users/showpad/orgs","repos_url":"https://api.github.com/users/showpad/repos","events_url":"https://api.github.com/users/showpad/events{/privacy}","received_events_url":"https://api.github.com/users/showpad/received_events","type":"Organization","site_admin":false},"repo":{"id":21271280,"name":"angular-colorpicker","full_name":"showpad/angular-colorpicker","owner":{"login":"showpad","id":2281179,"avatar_url":"https://avatars.githubusercontent.com/u/2281179?v=3","gravatar_id":"","url":"https://api.github.com/users/showpad","html_url":"https://github.com/showpad","followers_url":"https://api.github.com/users/showpad/followers","following_url":"https://api.github.com/users/showpad/following{/other_user}","gists_url":"https://api.github.com/users/showpad/gists{/gist_id}","starred_url":"https://api.github.com/users/showpad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/showpad/subscriptions","organizations_url":"https://api.github.com/users/showpad/orgs","repos_url":"https://api.github.com/users/showpad/repos","events_url":"https://api.github.com/users/showpad/events{/privacy}","received_events_url":"https://api.github.com/users/showpad/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/showpad/angular-colorpicker","description":"","fork":false,"url":"https://api.github.com/repos/showpad/angular-colorpicker","forks_url":"https://api.github.com/repos/showpad/angular-colorpicker/forks","keys_url":"https://api.github.com/repos/showpad/angular-colorpicker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/showpad/angular-colorpicker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/showpad/angular-colorpicker/teams","hooks_url":"https://api.github.com/repos/showpad/angular-colorpicker/hooks","issue_events_url":"https://api.github.com/repos/showpad/angular-colorpicker/issues/events{/number}","events_url":"https://api.github.com/repos/showpad/angular-colorpicker/events","assignees_url":"https://api.github.com/repos/showpad/angular-colorpicker/assignees{/user}","branches_url":"https://api.github.com/repos/showpad/angular-colorpicker/branches{/branch}","tags_url":"https://api.github.com/repos/showpad/angular-colorpicker/tags","blobs_url":"https://api.github.com/repos/showpad/angular-colorpicker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/showpad/angular-colorpicker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/showpad/angular-colorpicker/git/refs{/sha}","trees_url":"https://api.github.com/repos/showpad/angular-colorpicker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/showpad/angular-colorpicker/statuses/{sha}","languages_url":"https://api.github.com/repos/showpad/angular-colorpicker/languages","stargazers_url":"https://api.github.com/repos/showpad/angular-colorpicker/stargazers","contributors_url":"https://api.github.com/repos/showpad/angular-colorpicker/contributors","subscribers_url":"https://api.github.com/repos/showpad/angular-colorpicker/subscribers","subscription_url":"https://api.github.com/repos/showpad/angular-colorpicker/subscription","commits_url":"https://api.github.com/repos/showpad/angular-colorpicker/commits{/sha}","git_commits_url":"https://api.github.com/repos/showpad/angular-colorpicker/git/commits{/sha}","comments_url":"https://api.github.com/repos/showpad/angular-colorpicker/comments{/number}","issue_comment_url":"https://api.github.com/repos/showpad/angular-colorpicker/issues/comments{/number}","contents_url":"https://api.github.com/repos/showpad/angular-colorpicker/contents/{+path}","compare_url":"https://api.github.com/repos/showpad/angular-colorpicker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/showpad/angular-colorpicker/merges","archive_url":"https://api.github.com/repos/showpad/angular-colorpicker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/showpad/angular-colorpicker/downloads","issues_url":"https://api.github.com/repos/showpad/angular-colorpicker/issues{/number}","pulls_url":"https://api.github.com/repos/showpad/angular-colorpicker/pulls{/number}","milestones_url":"https://api.github.com/repos/showpad/angular-colorpicker/milestones{/number}","notifications_url":"https://api.github.com/repos/showpad/angular-colorpicker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/showpad/angular-colorpicker/labels{/name}","releases_url":"https://api.github.com/repos/showpad/angular-colorpicker/releases{/id}","created_at":"2014-06-27T09:50:28Z","updated_at":"2015-04-23T15:37:11Z","pushed_at":"2015-12-15T08:22:44Z","git_url":"git://github.com/showpad/angular-colorpicker.git","ssh_url":"git@github.com:showpad/angular-colorpicker.git","clone_url":"https://github.com/showpad/angular-colorpicker.git","svn_url":"https://github.com/showpad/angular-colorpicker","homepage":null,"size":79,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/showpad/angular-colorpicker/pulls/3"},"html":{"href":"https://github.com/showpad/angular-colorpicker/pull/3"},"issue":{"href":"https://api.github.com/repos/showpad/angular-colorpicker/issues/3"},"comments":{"href":"https://api.github.com/repos/showpad/angular-colorpicker/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/showpad/angular-colorpicker/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/showpad/angular-colorpicker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/showpad/angular-colorpicker/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/showpad/angular-colorpicker/statuses/32c0b1aa25d920a79545ef81e508bd5dd035ab02"}}}}