{"id":15690643,"url":"https://github.com/patrickjs/angular-event-emitter","last_synced_at":"2026-04-10T05:09:08.936Z","repository":{"id":12657213,"uuid":"15328979","full_name":"PatrickJS/angular-event-emitter","owner":"PatrickJS","description":"Event emitters for AngularJS ","archived":false,"fork":false,"pushed_at":"2014-07-19T03:11:59.000Z","size":212,"stargazers_count":8,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-08T00:04:55.220Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PatrickJS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-20T03:23:29.000Z","updated_at":"2018-11-09T18:37:24.000Z","dependencies_parsed_at":"2022-08-31T00:31:28.759Z","dependency_job_id":null,"html_url":"https://github.com/PatrickJS/angular-event-emitter","commit_stats":null,"previous_names":["gdi2290/angular-event-emitter"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrickJS%2Fangular-event-emitter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrickJS%2Fangular-event-emitter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrickJS%2Fangular-event-emitter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrickJS%2Fangular-event-emitter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PatrickJS","download_url":"https://codeload.github.com/PatrickJS/angular-event-emitter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252973682,"owners_count":21834107,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T18:13:16.258Z","updated_at":"2026-04-10T05:09:08.906Z","avatar_url":"https://github.com/PatrickJS.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"angular-event-emitter\n=====================\n\nEvent emitters for AngularJS \n\n\n#How do I add this to my project?\n\nYou can download angular-event-emitter by:\n\n* (prefered) Using bower and running `bower install angular-event-emitter --save`\n* Using npm and running `npm install angular-event-emitter --save`\n* Downloading it manually by clicking [here to download development unminified version](https://raw.github.com/gdi2290/angular-event-emitter/master/angular-event-emitter.js)\n\n\n````html\n\u003chtml\u003e\n\u003cbody ng-app=\"YOUR_APP\"\u003e\n  \u003cdiv ng-controller=\"MainController\"\u003e\n    \u003cspan ng-repeat=\"toggle in toggles\"\u003e\n        \u003cinput type=\"button\" ng-channel=\"click:{{ 'channel'+$index }}\" ng-emit=\"$index\" value=\"Toggle {{ toggle }}\" /\u003e\n    \u003c/span\u003e\n    \u003cbutton ng-click=\"add(toggles)\"\u003eAdd more\u003c/button\u003e\n\n    \u003cspan ng-repeat=\"toggle in toggles\"\n          ng-on=\"click:{{ 'channel'+$index }}\"\n          ng-execute=\"callback\"\n          toggle-section\u003e\n        \u003cp\u003eThis is section #{{ toggle }}\u003c/p\u003e\n    \u003c/span\u003e\n  \u003c/div\u003e\n\n\n  \u003cscript src=\"http://ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular.js\"\u003e\u003c/script\u003e\n  \u003cscript src=\"http://ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular-animate.js\"\u003e\u003c/script\u003e\n  \u003cscript src=\"bower_components/angular-event-emitter/angular-event-emitter.js\"\u003e\u003c/script\u003e\n  \u003cscript type=\"text/javascript\"\u003e\n    angular.module('YOUR_APP', [\n      'ngEventEmitter' // you may also use 'angular-event-emitter'\n    ])\n    .controller('MainController', function($scope, $once, $on, $emit) {\n        $once('event', function(event, args) {\n          console.log('$once ', args);\n        });\n        $on('event', function(event, args) {\n          console.log('$on', args);\n        });\n\n        $scope.add = function(collection) {\n          var lastIndex = collection.length-1;\n          var count = collection[lastIndex];\n          collection.push(count+1);\n        };\n\n        $scope.toggle = true;\n        $scope.toggles = [1,2,3];\n    //    $scope.triggerArgs = function() {};\n        $scope.callback = function(value) {\n          $emit('event', 'trigger event');\n          console.log('callback ', arguments);\n        };\n    })\n    .directive('toggleSection', function($animate) {\n      return function(scope, element, attrs) {\n        var toggle = true;\n        scope.$onRootScope('event:'+(attrs.ngOn || attrs.toggleSection), function(ev,num) {\n          toggle = !toggle;\n          var toggleClass = (toggle) ? 'removeClass' : 'addClass';\n          $animate[toggleClass](element, 'ng-hide');\n          $animate[toggleClass](element, 'ng-show');\n        });\n      }\n    });\n\n\n  \u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickjs%2Fangular-event-emitter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrickjs%2Fangular-event-emitter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickjs%2Fangular-event-emitter/lists"}