Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit a6afa78

Browse files
thorn0Narretz
authored andcommitted
docs(guide/Services): improve the code example
A factory that doesn't return anything is a bad example of a factory. Closes #14139
1 parent 3faa01f commit a6afa78

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

docs/content/guide/services.ngdoc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,13 @@ batchModule.factory('batchLog', ['$interval', '$log', function($interval, $log)
138138
*/
139139
batchModule.factory('routeTemplateMonitor', ['$route', 'batchLog', '$rootScope',
140140
function($route, batchLog, $rootScope) {
141-
$rootScope.$on('$routeChangeSuccess', function() {
142-
batchLog($route.current ? $route.current.template : null);
143-
});
141+
return {
142+
startMonitoring: function() {
143+
$rootScope.$on('$routeChangeSuccess', function() {
144+
batchLog($route.current ? $route.current.template : null);
145+
});
146+
}
147+
};
144148
}]);
145149

146150
```

0 commit comments

Comments
 (0)