From cd3dd134255eb40bae0b6c3fef622d3bc9c3f9b9 Mon Sep 17 00:00:00 2001 From: Ore Landau Date: Thu, 13 Jun 2013 13:12:51 +0300 Subject: [PATCH] docs(guide/di): fix headings hierarchy --- docs/content/guide/di.ngdoc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/content/guide/di.ngdoc b/docs/content/guide/di.ngdoc index e1b57d31aa6e..3e8b7138f82d 100644 --- a/docs/content/guide/di.ngdoc +++ b/docs/content/guide/di.ngdoc @@ -105,17 +105,17 @@ dependencies of `MyController` without the controller ever knowing about the inj the best outcome. The application code simply asks for the dependencies it needs, without having to deal with the injector. This setup does not break the Law of Demeter. -# Dependency Annotation +## Dependency Annotation How does the injector know what service needs to be injected? The application developer needs to provide annotation information that the injector uses in order -to resolve the dependencies. Throughout Angular certain API functions are invoked using the +to resolve the dependencies. Throughout Angular, certain API functions are invoked using the injector, as per the API documentation. The injector needs to know what services to inject into the function. Below are three equivalent ways of annotating your code with service name information. These can be used interchangeably as you see fit and are equivalent. -# Inferring Dependencies +### Inferring Dependencies The simplest way to get hold of the dependencies, is to assume that the function parameter names are the names of the dependencies. @@ -134,7 +134,7 @@ While straightforward, this method will not work with JavaScript minifiers/obfus rename the method parameter names. This makes this way of annotating only useful for {@link http://www.pretotyping.org/ pretotyping}, and demo applications. -# `$inject` Annotation +### `$inject` Annotation To allow the minifers to rename the function parameters and still be able to inject right services the function needs to be annotated with the `$inject` property. The `$inject` property is an array @@ -153,7 +153,7 @@ function declaration. This method of annotation is useful for controller declarations since it assigns the annotation information with the function. -# Inline Annotation +### Inline Annotation Sometimes using the `$inject` annotation style is not convenient such as when annotating directives. @@ -189,11 +189,11 @@ For this reason the third annotation style is provided as well. Keep in mind that all of the annotation styles are equivalent and can be used anywhere in Angular where injection is supported. -# Where can I use DI? +## Where can I use DI? DI is pervasive throughout Angular. It is typically used in controllers and factory methods. -## DI in controllers +### DI in controllers Controllers are classes which are responsible for application behavior. The recommended way of declaring controllers is: @@ -209,7 +209,7 @@ declaring controllers is: -## Factory methods +### Factory methods Factory methods are responsible for creating most objects in Angular. Examples are directives, services, and filters. The factory methods are registered with the module, and the recommended way