aboutsummaryrefslogtreecommitdiffstats
path: root/docs/content/guide/dev_guide.services.creating_services.ngdoc
diff options
context:
space:
mode:
authorCaitlin Potter2014-02-06 14:02:18 +0000
committerPeter Bacon Darwin2014-02-16 19:03:40 +0000
commitf7d28cd377f06224247b950680517a187a7b6749 (patch)
tree20203b9f7bf60748bb752f325b1869415352a6f3 /docs/content/guide/dev_guide.services.creating_services.ngdoc
parent2e641ac49f121a6e2cc70bd3879930b44a8a7710 (diff)
downloadangular.js-f7d28cd377f06224247b950680517a187a7b6749.tar.bz2
docs(all): convert <pre>/</pre> snippets to GFM snippets
Diffstat (limited to 'docs/content/guide/dev_guide.services.creating_services.ngdoc')
-rw-r--r--docs/content/guide/dev_guide.services.creating_services.ngdoc14
1 files changed, 8 insertions, 6 deletions
diff --git a/docs/content/guide/dev_guide.services.creating_services.ngdoc b/docs/content/guide/dev_guide.services.creating_services.ngdoc
index bdcf42ad..c6210cc1 100644
--- a/docs/content/guide/dev_guide.services.creating_services.ngdoc
+++ b/docs/content/guide/dev_guide.services.creating_services.ngdoc
@@ -22,17 +22,19 @@ by using the {@link api/AUTO.$provide $provide} service in the module configurat
function. The following pseudo-code shows both approaches:
Using the angular.Module api:
-<pre>
+
+```js
var myModule = angular.module('myModule', []);
myModule.factory('serviceId', function() {
var shinyNewServiceInstance;
//factory function body that constructs shinyNewServiceInstance
return shinyNewServiceInstance;
});
-</pre>
+```
Using the $provide service:
-<pre>
+
+```js
angular.module('myModule', [], function($provide) {
$provide.factory('serviceId', function() {
var shinyNewServiceInstance;
@@ -40,7 +42,7 @@ angular.module('myModule', [], function($provide) {
return shinyNewServiceInstance;
});
});
-</pre>
+```
Note that you are not registering a service instance, but rather a factory function that will
create this instance when called.
@@ -58,7 +60,7 @@ Following is an example of a very simple service. This service depends on the `$
stores all notifications; after the third one, the service displays all of the notifications by
window alert.
-<pre>
+```js
angular.module('myModule', [], function($provide) {
$provide.factory('notify', ['$window', function(win) {
var msgs = [];
@@ -71,7 +73,7 @@ angular.module('myModule', [], function($provide) {
};
}]);
});
-</pre>
+```
# Instantiating Angular Services