A lightweight Angular library that wraps
HttpClient
to handle origin issues and enable seamless state transfer for SSR/CSR apps.
- ✅ Provides a simple, reusable HTTP service
- ✅ Works out-of-the-box with Angular SSR (Universal)
- ✅ Handles origin header injection on server-side
- ✅ Pluggable for custom logic
pnpm add ngx-transmission
# or
npm install ngx-transmission
- Import the module in your
AppModule
(Browser)
//app.module.ts
@NgModule({
imports: [
...,
NgxTransmissionModule.forRoot({
origin: 'http://localhost:3000' // required only for SSR
})
]
})
export class AppModule {}
and in your AppServerModule
(Server)
//app.module.server.ts
@NgModule({
imports: [
...
NgxTransmissionModule.forRoot({
origin: 'http://localhost:4200' // required only for SSR
})
],
bootstrap: [AppComponent],
})
@Component({...})
export class ExampleComponent {
constructor(
private api: NgxTransmissionService
) {}
ngOnInit() {
this.api
.get('/api/posts')
.subscribe(console.log);
}
}
-
Add
TransferState
integration -
Add life cycle hooks support
-
Add request/response caching
-
Provide better type-safe options wrapper