I suggest to create a UserService (check how to create service for angular online) and move $resource to UserService