diff options
| author | Brian Ford | 2013-10-11 16:05:27 -0700 | 
|---|---|---|
| committer | Brian Ford | 2013-10-11 16:15:36 -0700 | 
| commit | 8ec7668131b4de727400088bf2603457d57eb581 (patch) | |
| tree | e2d1d5205a308afcf0e7f16171d4cb0e6eb079f2 /docs/content/tutorial/step_10.ngdoc | |
| parent | a61d7999a4857871c2e2f73760d85ca6ab747858 (diff) | |
| download | angular.js-8ec7668131b4de727400088bf2603457d57eb581.tar.bz2 | |
docs(tutorial/step10): use DI annotations
Diffstat (limited to 'docs/content/tutorial/step_10.ngdoc')
| -rw-r--r-- | docs/content/tutorial/step_10.ngdoc | 24 | 
1 files changed, 13 insertions, 11 deletions
| diff --git a/docs/content/tutorial/step_10.ngdoc b/docs/content/tutorial/step_10.ngdoc index 9e629861..fef006c9 100644 --- a/docs/content/tutorial/step_10.ngdoc +++ b/docs/content/tutorial/step_10.ngdoc @@ -25,17 +25,19 @@ GitHub}:  __`app/js/controllers.js`:__  <pre>  ... -var phonecatApp = angular.module('phonecatApp',[]); -phonecatApp.controller('PhoneDetailCtrl', ['$scope', '$routeParams', '$http', function($scope, $routeParams, $http) { -  $http.get('phones/' + $routeParams.phoneId + '.json').success(function(data) { -    $scope.phone = data; -    $scope.mainImageUrl = data.images[0]; -  }); +var phonecatControllers = angular.module('phonecatControllers',[]); + +phonecatControllers.controller('PhoneDetailCtrl', ['$scope', '$routeParams', '$http', +  function($scope, $routeParams, $http) { +    $http.get('phones/' + $routeParams.phoneId + '.json').success(function(data) { +      $scope.phone = data; +      $scope.mainImageUrl = data.images[0]; +    }); -  $scope.setImage = function(imageUrl) { -    $scope.mainImageUrl = imageUrl; -  } -}]); +    $scope.setImage = function(imageUrl) { +      $scope.mainImageUrl = imageUrl; +    } +  }]);  </pre>  In the `PhoneDetailCtrl` controller, we created the `mainImageUrl` model property and set its @@ -133,7 +135,7 @@ template remains operational.  # Summary -With the phone image swapper in place, we're ready for {@link step_11 step 11} (the last step!) to +With the phone image swapper in place, we're ready for {@link step_11 step 11} to  learn an even better way to fetch data. | 
