angular/angular.js — pull request #10080 by bwestrich (2014-11-16 15:11:23+00:00)
Title: docs(tutorial/5 - XHRs

The documentation describes the code to be written in a different order than the code is actually written. I'm not an angular expert, but I found that putting the scope creation and controller creation BEFORE the httpBackend setup code doesn't cause problems (at least the tests still pass). I also reordered the parameters passed into inject(function( to match the order that we use them in the function). Here's the resulting code that is consistent with my suggested doc modification:

beforeEach(inject(function($rootScope, $controller, _$httpBackend_) {
scope = $rootScope.$new();
ctrl = $controller('PhoneListCtrl', {$scope: scope});

$httpBackend = _$httpBackend_;
$httpBackend.expectGET('phones/phones.json').
respond([{name: 'Nexus S'}, {name: 'Motorola DROID'}]);
}));