docs(ngMock): fix example for $http respond() helper with function as 1st param

The  `whenPOST` method should return a response object containing status, response body and headers.
If omitted the following error will be thrown:

`Uncaught TypeError: Cannot read property '2' of undefined`

The documentation doesn't make it very clear, so I think it will be appropriate to add it here.

Closes #6761
This commit is contained in:
Søren Louv-Jansen
2014-03-19 00:46:56 -07:00
committed by Caitlin Potter
parent e1f1d65d0c
commit 1f1cad8517

View File

@@ -1793,7 +1793,9 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
*
* // adds a new phone to the phones array
* $httpBackend.whenPOST('/phones').respond(function(method, url, data) {
* phones.push(angular.fromJson(data));
* var phone = angular.fromJson(data);
* phones.push(phone);
* return [200, phone, {}];
* });
* $httpBackend.whenGET(/^\/templates\//).passThrough();
* //...