switch .service to .factory to fix TypeError