@@ -30,12 +30,12 @@ Do not use controllers to:
30
30
services} instead.
31
31
- Manage the life-cycle of other components (for example, to create service instances).
32
32
33
- # Setting up the initial state of a `$scope` object
33
+ ## Setting up the initial state of a `$scope` object
34
34
35
35
Typically, when you create an application you need to set up the initial state for the Angular
36
36
`$scope`. You set up the initial state of a scope by attaching properties to the `$scope` object.
37
37
The properties contain the **view model** (the model that will be presented by the view). All the
38
- `$scope` properties will be available to the template at the point in the DOM where the Controller
38
+ `$scope` properties will be available to the {@link templates template} at the point in the DOM where the Controller
39
39
is registered.
40
40
41
41
The following example demonstrates creating a `GreetingController`, which attaches a `greeting`
@@ -69,7 +69,7 @@ now be data-bound to the template:
69
69
```
70
70
71
71
72
- # Adding Behavior to a Scope Object
72
+ ## Adding Behavior to a Scope Object
73
73
74
74
In order to react to events or execute computation in the view we must provide behavior to the
75
75
scope. We add behavior to the scope by attaching methods to the `$scope` object. These methods are
@@ -99,7 +99,7 @@ objects (or primitives) assigned to the scope become model properties. Any metho
99
99
the scope are available in the template/view, and can be invoked via angular expressions
100
100
and `ng` event handler directives (e.g. {@link ng.directive:ngClick ngClick}).
101
101
102
- # Using Controllers Correctly
102
+ ## Using Controllers Correctly
103
103
104
104
In general, a Controller shouldn't try to do too much. It should contain only the business logic
105
105
needed for a single view.
@@ -125,7 +125,7 @@ following components:
125
125
- A model consisting of a string named `spice`
126
126
- A Controller with two functions that set the value of `spice`
127
127
128
- The message in our template contains a binding to the `spice` model, which by default is set to the
128
+ The message in our template contains a binding to the `spice` model which, by default, is set to the
129
129
string "very". Depending on which button is clicked, the `spice` model is set to `chili` or
130
130
`jalapeño`, and the message is automatically updated by data-binding.
131
131
@@ -259,7 +259,7 @@ Inheritance works with methods in the same way as it does with properties. So in
259
259
examples, all of the properties could be replaced with methods that return string values.
260
260
261
261
262
- ## Testing Controllers
262
+ # Testing Controllers
263
263
264
264
Although there are many ways to test a Controller, one of the best conventions, shown below,
265
265
involves injecting the {@link ng.$rootScope $rootScope} and {@link ng.$controller $controller}:
0 commit comments