Use resoures instead of http requests in AngularJS