Documentation
Querying your API (client)
JavaScript frameworks
Angular

Angular

Fuse supports querying your data from angular, as long as your querying library supports typed-document nodes then your output and variables will be typed. An example client would be Apollo-angular (opens in a new tab)

Constructing a typed-document-node for a query:

import { graphql } from '../fuse'
import { Avatar, AvatarFragment } from './components/Avatar'
 
const UserQuery = graphql(`
  query User ($id: ID!) {
    user(id: $id) {
      name
      ...Avatar_UserFields
    }
  }
`, [AvatarFragment])

and for a fragment:

import { graphql, readFragment, FragmentOf } from '../../fuse'
 
export const AvatarFragment = graphql(`
  fragment Avatar_UserFields on User {
    name
    avatarUrl
  }
`)
 
// Derive the input-type: FragmentOf<typeof AvatarFragment>
// Apply fragment-masking: readFragment(AvatarFragment, user);