'use strict'; (function(){ angular.module('app') .factory('MyController', MyController); MyController.$inject = [ '$rootScope' ]; function MyController($rootScope){ $rootScope.$on( 'myService:myValueChanged', function valueChanged(event, newValue) { console.log('new value:', newValue); } ); } }());