mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-05-09 20:06:24 +08:00
docs(tutorial): fix style across tutorial steps
This commit is contained in:
@@ -54,16 +54,15 @@ components themselves, but by the DI subsystem).
|
||||
|
||||
__`app/js/controllers.js:`__
|
||||
<pre>
|
||||
function PhoneListCtrl($scope, $http) {
|
||||
var phonecatApp = angular.module('phonecatApp', []);
|
||||
|
||||
phonecatApp.controller('PhoneListCtrl', function PhoneListCtrl($scope) {
|
||||
$http.get('phones/phones.json').success(function(data) {
|
||||
$scope.phones = data;
|
||||
});
|
||||
|
||||
$scope.orderProp = 'age';
|
||||
}
|
||||
|
||||
var phonecatApp = angular.module('phonecatApp',[]);
|
||||
phonecatApp.controller('PhoneListCtrl', PhoneListCtrl);
|
||||
});
|
||||
</pre>
|
||||
|
||||
`$http` makes an HTTP GET request to our web server, asking for `phone/phones.json` (the url is
|
||||
@@ -107,7 +106,7 @@ constructor function, if you were to {@link http://en.wikipedia.org/wiki/Minific
|
||||
minify} the JavaScript code for `PhoneListCtrl` controller, all of its function arguments would be
|
||||
minified as well, and the dependency injector would not be able to identify services correctly.
|
||||
|
||||
There are two ways to overcome issues caused by minification.
|
||||
There are two ways to overcome issues caused by minification:
|
||||
|
||||
* You can create a `$inject` property on the controller function which holds an array of strings.
|
||||
Each string in the array is the name of the service to inject for the corresponding parameter.
|
||||
|
||||
Reference in New Issue
Block a user