connecting angular resource to factory