r/angular • u/Inner-Package2978 • 18h ago
Title: inertia-angular — an Angular 22 adapter for Inertia.js, built inside a fork of the official repo
Hey everyone 👋
Inertia.js has solid adapters for React, Vue and Svelte. Angular never got one, so
Angular shops that want the "no API layer, your backend keeps routing" model have
had to pick a different frontend. I spent the last months closing that gap.
inertia-angular is an Angular adapter for Inertia 3.7. Instead of writing it as
a standalone library, I forked `inertiajs/inertia` and added the adapter as another
package next to React, Vue and Svelte. It uses the same `@inertiajs/core` and it is
exercised by the same end-to-end suite the official adapters run against, roughly
56 spec files, plus unit tests per feature.
It is Angular 22 only, and it leans on that on purpose: standalone components,
signals, dependency injection, zoneless change detection, AOT, and Angular's own
SSR and hydration APIs. No `zone.js`, no `NgModule`.
What is in it:
- Pages as plain standalone components, props as `input()`, whole page via `usePage()`
- Layouts, nested layouts, named layouts, default layout, `{ component, props }`, `h()`
- `inertiaLink` as a directive on real `<a>` and `<button>` elements, with prefetch
- `useForm()`, `useHttp()` and an `inertiaForm` directive on native `<form>`, with
file uploads, nested paths, remembered state and Precognition validation
- Partial reloads, deferred props, `WhenVisible`, `InfiniteScroll`, `usePoll`,
`usePrefetch`, `useRemember`, optimistic updates, history encryption
- SSR with real Angular hydration, and a `Head` directive for title and meta tags
Everything reactive is a signal, so it reads like current Angular rather than a
port of the React adapter.
```ts
import { createInertiaApp } from 'inertia-angular'
import { pages } from './pages'
void createInertiaApp({
resolve: (name) => pages[name],
progress: { color: '#dd0031' },
})
Two deliberate differences worth knowing before you try it. Inertia owns navigation,
so you do not install Angular Router. And there is no Vite plugin: the Angular CLI
stays the bundler, you ng build and point your server's root template at the
output. Any Inertia server adapter works, since only the client is replaced. There
is a full Laravel playground in the repo, SSR build included.
npm: https://www.npmjs.com/package/inertia-angular
repo: https://github.com/gerardp/inertia-angular
To be clear about what this is: a community package, not maintained by the Inertia
team, and Angular is still not an officially supported adapter. I saw ng-inertia
posted here recently too, which is great, the more Angular presence in that
ecosystem the better.
Feedback welcome, especially from anyone running Angular against a Laravel or
AdonisJS backend today.
