Skip to content
🔺
@tuvix.js/angular
Angular Bindings
Angular 15+ bindings for Tuvix.js. NgModule, service injection, and RxJS-based event bus integration.

Installation

bash
npm install @tuvix.js/angular @angular/core @angular/platform-browser-dynamic

API

createAngularMicroApp(options)

Creates an Angular micro-application instance.

Parameters:

ParameterTypeRequiredDescription
namestringYesUnique name for the micro-app
moduleanyYesThe root Angular NgModule
platform() => anyYesPlatform factory (e.g., platformBrowserDynamic)
selectorstringNoRoot element selector (defaults to 'app-root')
compilerOptionsRecord<string, unknown>NoAngular compiler options
bootstrap() => void | Promise<void>NoCustom bootstrap function
ts
import { createAngularMicroApp } from '@tuvix.js/angular';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';

export const app = createAngularMicroApp({
  name: 'angular-app',
  module: AppModule,
  platform: platformBrowserDynamic,
});

TuvixModule

Import into your Angular module to enable prop injection and event service:

ts
import { TuvixModule } from '@tuvix.js/angular';

@NgModule({
  imports: [BrowserModule, TuvixModule],
})
export class AppModule {}

TuvixPropsService

Inject shell props into any Angular component or service:

ts
constructor(private tuvixProps: TuvixPropsService) {
  const props = this.tuvixProps.getProps<{ userId: string }>();
}

TuvixEventService

RxJS-based wrapper around the event bus:

ts
constructor(private events: TuvixEventService) {
  this.events.on('theme:changed').subscribe(({ theme }) => {
    this.currentTheme = theme;
  });
}

See the Angular Guide for the full example.

Released under the MIT License.