mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-01 22:37:41 +08:00
docs(tutorial/step-11): add controller to correct object
This commit is contained in:
committed by
Peter Bacon Darwin
parent
666137d635
commit
2407891ddf
@@ -81,14 +81,16 @@ now to understand what the code in our controllers is doing.
|
||||
__`app/js/controllers.js`.__
|
||||
|
||||
```js
|
||||
var phonecatControllers = angular.module('phonecatControllers', []);
|
||||
|
||||
...
|
||||
|
||||
phonecatApp.controller('PhoneListCtrl', ['$scope', 'Phone', function($scope, Phone) {
|
||||
phonecatControllers.controller('PhoneListCtrl', ['$scope', 'Phone', function($scope, Phone) {
|
||||
$scope.phones = Phone.query();
|
||||
$scope.orderProp = 'age';
|
||||
}]);
|
||||
|
||||
phonecatApp.controller('PhoneDetailCtrl', ['$scope', '$routeParams', 'Phone', function($scope, $routeParams, Phone) {
|
||||
phonecatControllers.controller('PhoneDetailCtrl', ['$scope', '$routeParams', 'Phone', function($scope, $routeParams, Phone) {
|
||||
$scope.phone = Phone.get({phoneId: $routeParams.phoneId}, function(phone) {
|
||||
$scope.mainImageUrl = phone.images[0];
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user