I have a problem about $http in Angularjs. I'm building system register step by step, I need to call $http to Facebook and receive result returned from Facebook at step one, so if there are error, this error is shown at step two. I want that this error will be shown at step one. I use Angularjs with Coffeescript!
### step one ###
#check username
if $scope.username == ""
$scope.errorMessage.push "please enter username"
$http(
method: "GET"
url: "https://graph.facebook.com/" + identifier
).success((data, status, headers, config) ->
... do something...
).error((data, status, headers, config) ->
... if there is error
$scope.errorMessage.push "error"
# break if has errors
if $scope.errorMessage.length > 0
$scope.scrollTo("back-to-top")
return false
# if everthing ok -> continue next step
return true
### step two ####
...do something...