Questions tagged [apollo-angular]

Questions that are about the usage of the "apollo-angular" npm package which integrates ApolloClient with the Angular javascript framework.

Questions that are about the usage of the "apollo-angular" npm package which integrates ApolloClient with the Angular javascript framework. See https://github.com/apollographql/apollo-angular

85 questions
2
votes
1 answer

RxJS unsubscribe hook

Having a piece of code that fetches some data to a cache, and keeps it in sync using a websocket connection, and provides an access interface to the data using an Observable, how can I know that there are no subscribers to said data at one point in…
Ákos Vandra-Meyer
  • 1,890
  • 1
  • 23
  • 40
2
votes
0 answers

405 Method Not Allowed when trying to connect apollo-angular client to graphql-server

Im trying to connect my angular-Apollo Client to my graphql backend and I Keep getting a 405 error. My Server is hosted on localhost port 4000 and my Client is also on localhost (port 4200). For my client i used the Basic Setup as shown in the…
2
votes
2 answers

Apollo Codegen No operations or fragments found to generate code for

I am trying to setup an apollo project to learn a bit how it works. I downloaded graphQL nodeJS template from node-graphql-server I setup a simple angular9 application using apollo-angular I run the server, and I wanted to autogenerate the type in…
Bobby
  • 4,372
  • 8
  • 47
  • 103
2
votes
0 answers

Why does ApolloTestingModule in Angular spec file with jest throw: "Cannot read property 'use' of undefined?

I am trying to combine Angular, Jest and Apollo. My Spec file follows the structure described in the documentation here. When I run only jest like this: jest --watchAll everything works. But if I like this: jest --watchAll --collectCoverage, all…
DauleDK
  • 3,313
  • 11
  • 55
  • 98
2
votes
1 answer

Apollo Angular not sending request

I have a simple query (Apollo-Angular Client) to fetch some data from an GraphQL server public getQuestionBank(courseCode: string): Observable> { const query = gql` query GetQuestionsQuery($courseCode: String!) { …
1
vote
0 answers

Why does GraphiQL not show the "data" property, but just the "errors" property for Subscriptions?

When executing a Subscription via GraphiQL (v 1.5.1) which throws an error, but also contains data, why doesn´t GraphiQL show the data? And how to achieve this? In the following screenshot it can be seen that the payload of the websocket message…
marvinfrede
  • 1,055
  • 5
  • 12
1
vote
1 answer

Angular 14 Upgrade w/ Jest 28 and Nx Having Issues with Jest Tests "Cannot find module 'apollo-angular'"

I have a very peculiar issue that I've been working on for quite some time. I am in the process of upgrading our main frontend app from Angular 12 to Angular 14. All the migrations were successful. The app builds and runs just fine. However, the…
Nate
  • 345
  • 3
  • 12
1
vote
0 answers

Filling fields with subscription values with Apollo-Angular with codegen

Hello) I want the category fields to be filled in the form with values from the category that I received from the server. I'm doing similarly from a course that uses RestAPI, but I'm using Nestjs - Apollo - Angular and I can't seem to achieve this…
1
vote
0 answers

Failed to map apollo-angular watch().valuechanges

im trying to create a graphql service to get and keep my data. To do that im extending a graphql-base.service, who has a executeQuery method, that return a observable. graphql-base: export class GraphqlBaseService { constructor() {} …
Flávio Costa
  • 895
  • 5
  • 18
  • 41
1
vote
1 answer

how to import a default exported graphql query in angular 12?

I have an angular 12 project and i wanna use graphql with apollo-angular. i create a category.js file with the codes below: import gql from 'graphql-tag'; const CATEGORIES_QUERY = gql` query Categories { categories { id name …
fariba.j
  • 1,737
  • 7
  • 23
  • 42
1
vote
1 answer

Apollo-Angular query return weird behaviour

I am trying to connect Angular with a GraphQL backend. However, when angular-apollo requests data from GraphQL, the data is being sent correctly but when I want to access it, it returns undefined. In the following code, updateItems() is working…
dippa
  • 97
  • 2
  • 6
1
vote
3 answers

How to load runtime configuration and use it in an angular module?

Following the Apollo Angular setup src/app/graphql.module.ts import { NgModule } from '@angular/core'; import { APOLLO_OPTIONS } from 'apollo-angular'; import { ApolloClientOptions, InMemoryCache, createHttpLink } from '@apollo/client/core'; import…
BKH
  • 696
  • 7
  • 16
1
vote
2 answers

Running Apollo Angular watchQuery() with different variables return the cache data

So, I am working on a project's feature that allows users to view data based on different variables, for example, data that are unique to years, location, gender etc. Below is the code that I write: this._querySubscription =…
Rasyue
  • 60
  • 1
  • 9
1
vote
0 answers

Retrying failed graphql requests with new authentication token in Apollo Angular

I am trying to create a flow for refreshing JWT token when a request fails because of an invalid token. My flow is as follows: make the request with authentication header catch the failed request because of invalid token make an API call to refresh…
1
vote
2 answers

How cant test Query, Mutation, Subscription services using Apollo Angular?

I saw the examples of how testing apollo in angular works and basically only use the ApolloTestingModule to make the tests. And my test looks like: Test suit describe('CountriesService', () => { let countryService: CountriesService; let…