<%- include('../../common/partial/header.unfinished.txt') %> * @ngdoc service * @name <%= appNameCamel %>.<%= serviceName %> * <% if (subscribeAndNotify) { %>@requires $rootScope<% } %> * @description * */ (function (angular) { 'use strict'; angular .module('<%= appNameCamel %>') .factory('<%= serviceName %>', <%= serviceName %>); <%= serviceName %>.$inject = [ <% if (subscribeAndNotify) { %>'$rootScope'<% } %> ]; function <%= serviceName %>(<% if (subscribeAndNotify) { %>$rootScope<% } %>) {<% if (subscribeAndNotify) { %> const methods = { notify }; <% } %>return { <% if (subscribeAndNotify) { %>subscribe<% } %> };<% if (subscribeAndNotify) { %> function subscribe($scope, $callback) { const handler = $rootScope.$on('<%= serviceName %>:changed', () => { $callback({}); }); $scope.$on('$destroy', handler); } function notify() { $rootScope.$emit('<%= serviceName %>:changed'); }<% } %> } })(window.angular);