Angularjs unit testing with $http.
How it all hangs together
$http callback methods.
Scoping of parameters and .success() and .errror()
You can interact with the $scope or $rootScope to set or change data. The scoping of the .success() and .error() means you cannot use a method level parameter and expect the value to be assigned before the the method ends. It can go out of scope before it is guaranteed to be set.