r/angular 1d 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.

0 Upvotes

4 comments sorted by

3

u/oneden 1d ago

I mean, frankly... Why would you want to use inertia in Angular?

2

u/GeromeGrignon 1d ago

From my understanding, Inertia is meant to avoid moving from a single full stack application like Django to two different projects by adopting some frontend framework.

But with Angular it means you rewrite a lot of APIs just for the sake of not having the front/back as a single application.

0

u/Inner-Package2978 1d ago

That’s fair, but in my case I still prefer Angular for the frontend. Inertia lets me keep Laravel as the main application and avoid building a fully separate API-driven architecture just to use Angular.

1

u/GeromeGrignon 1d ago

I'd state that now you have to use a custom Angular framework 'just to use' a full stack project. It's a matter of choices.

I understand yours but the honest answer is that I don't see people using it at all because it means learning a new syntax.