@molecule/app-home-page-angular

Feature · home-page · App (browser) · v1.1.1 · Apache-2.0

Authenticated home page rendering a personalized greeting (h2 with user name or fallback). Reads auth + i18n; styled via ClassMap.

npm install @molecule/app-home-page-angular

npm · Source on GitHub

How it works

@molecule/app-home-page-angular is a ready-made home-page feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.

<!-- The host element IS React's root: a div, not a custom tag. -->
<div mol-home-page></div>

Works with: @molecule/app-angular, @molecule/app-auth, @molecule/app-ui, @molecule/app-ui-angular

Reference

<Home /> (Angular) — authenticated home page with personalized greeting.

The Angular counterpart of @molecule/app-home-page-react: same export, same DOM for the same input. Renders a single H2 of the form {home.greeting}{name|email|home.world}! using the universal common-locale bond. Used as the default post-login landing page when the app has no app-specific dashboard.

Replaces the byte-identical pages/Home.tsx shipped by 19 of the 38 flagship apps that have an authenticated Home route. Apps that override home.greeting per-app (e.g. note-taking's "Hello, {{name}}.") get the override automatically — the page reads the resolved translation, which spreads the bond default beneath any per-app override.

Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit src/index.ts JSDoc, not this file.

Quick Start

<!-- The host element IS React's root: a div, not a custom tag. -->
<div mol-home-page></div>
import { Component } from '@angular/core'
import { Home } from '@molecule/app-home-page-angular'

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [Home],
  template: `<main><div mol-home-page></div></main>`,
})
export class AppComponent {}

Type

feature

Installation

npm install @molecule/app-home-page-angular @angular/common @angular/core @angular/platform-browser @molecule/app-angular @molecule/app-auth @molecule/app-ui @molecule/app-ui-angular

API

Classes

Home

Authenticated home page — a personalized greeting headline.

The host IS React's root <div> (div[mol-home-page]), matching React's DOM exactly. Renders a single H2 of the form: {home.greeting}{user.name || user.email || home.world}!

home.greeting and home.world both come from the universal common-locale bond (@molecule/app-locales-common), so the page is fully translated out of the box. Apps can override home.greeting per-app (e.g. note-taking's "Hello, {{name}}.") simply by including the key in their own locale ui.ts.

@Component({
  selector: 'div[mol-home-page]',
  standalone: true,
  host: {
    '[class]': 'classes()',
  },
  template: `<h2 [class]="headlineClasses()">{{ headline() }}</h2>`,
})
export class Home {
  /** The auth composable — the session's user as a signal. */
  private readonly auth = useAuth<UserProfile>()

  /** The i18n composable — `t` re-runs on every locale switch. */
  private readonly i18n = useTranslation()

  /**
   * The current class map.
   * @returns The UIClassMap.
   */
  cm(): UIClassMap {
    return getClassMap()
  }

  /**
   * Computes the wrapper class list.
   * @returns The class string.
   */
  classes(): string {
    return this.cm().cn(this.cm().textCenter, this.cm().sp('py', 12))
  }

  /**
   * Computes the headline class list.
   * @returns The class string.
   */
  headlineClasses(): string {
    return this.cm().cn(this.cm().textSize('3xl'), this.cm().fontWeight('bold'))
  }

  /**
   * The greeting headline, reactive to auth and locale changes.
   * Concatenated into one expression so the template doesn't insert
   * whitespace between greeting and name — keeps the rendered output
   * identical to the byte-identical fleet original (`Hello, World!`,
   * not `Hello,  World!`).
   * @returns The headline text.
   */
  readonly headline = computed(() => {
    const user = this.auth.user()
    return `${this.i18n.t('home.greeting')}${user?.name || user?.email || this.i18n.t('home.world')}!`
  })
}

Injection Notes

Requirements

Peer dependencies:

  • @angular/common ^22.0.0
  • @angular/core ^22.0.0
  • @angular/platform-browser ^22.0.0
  • @molecule/app-angular ^3.5.0 || ^4.0.0
  • @molecule/app-auth ^3.0.0
  • @molecule/app-ui ^1.0.1
  • @molecule/app-ui-angular ^1.1.0

Runtime Dependencies

  • @angular/common

  • @angular/core

  • @angular/platform-browser

  • @molecule/app-angular

  • @molecule/app-auth

  • @molecule/app-ui

  • @molecule/app-ui-angular

  • Calls useAuth() and useTranslation() — both THROW unless the app's providers include provideMolecule({ auth, i18n }) (from @molecule/app-angular; scaffolded apps do this in app.config.ts).

  • home.greeting / home.world have NO inline English fallback: they resolve from @molecule/app-locales-common, which the app's i18n setup merges automatically. A custom i18n setup must register the common bond or the raw keys render on screen.