$q example to make sync the http request and other stuff