@@ -117,25 +117,25 @@ There are two ways to overcome issues caused by minification:
117
117
* You can create a `$inject` property on the controller function which holds an array of strings.
118
118
Each string in the array is the name of the service to inject for the corresponding parameter.
119
119
In the case of our example we would write:
120
-
120
+ <pre>
121
121
function PhoneListCtrl($scope, $http) {...}
122
122
PhoneListCtrl.$inject = ['$scope', '$http'];
123
123
phonecatApp.controller('PhoneListCtrl', PhoneListCtrl);
124
-
124
+ </pre>
125
125
* Use the inline bracket notation which wraps the function to be injected into an array of strings
126
126
(representing the dependency names) followed by the function to be injected:
127
-
127
+ <pre>
128
128
function PhoneListCtrl($scope, $http) {...}
129
129
phonecatApp.controller('PhoneListCtrl', ['$scope', '$http', PhoneListCtrl]);
130
-
130
+ </pre>
131
131
Both of these methods work with any function that can be injected by Angular, so it's up to your
132
132
project's style guide to decide which one you use.
133
133
134
134
When using the second method, it is common to provide the constructor function inline as an
135
135
anonymous function when registering the controller:
136
-
136
+ <pre>
137
137
phonecatApp.controller('PhoneListCtrl', ['$scope', '$http', function($scope, $http) {...}]);
138
-
138
+ </pre>
139
139
140
140
From this point onward, we're going to use the inline method in the tutorial. With that in mind,
141
141
let's add the annotations to our `PhoneListCtrl`:
0 commit comments