Add starting point component to view

This commit is contained in:
Z. Charles Dziura 2025-06-30 21:27:18 -04:00
parent 850b99d871
commit 8b3def5728
6 changed files with 21 additions and 5 deletions

View file

@ -1,4 +1,7 @@
<main> <main>
<h1>Hello, world!</h1> @switch (currentView$ | async) {
<p>Current View: {{ currentView$ | async }}</p> @default {
<app-starting-point></app-starting-point>
}
}
</main> </main>

View file

@ -1,13 +1,15 @@
import { AsyncPipe } from '@angular/common'; import { AsyncPipe } from '@angular/common';
import { Component, inject, OnInit } from '@angular/core'; import { ChangeDetectionStrategy, Component, inject, OnInit } from '@angular/core';
import { select, Store } from '@ngrx/store'; import { select, Store } from '@ngrx/store';
import { selectCurrentView } from './state/state.selectors'; import { selectCurrentView } from './state/state.selectors';
import { StartingPoint } from './views/starting-point/starting-point';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
templateUrl: './app.html', templateUrl: './app.html',
styleUrl: './app.scss', styleUrl: './app.scss',
imports: [AsyncPipe], changeDetection: ChangeDetectionStrategy.OnPush,
imports: [AsyncPipe, StartingPoint],
}) })
export class App implements OnInit { export class App implements OnInit {
private readonly store$ = inject(Store); private readonly store$ = inject(Store);

View file

@ -5,7 +5,7 @@ export interface AppState {
} }
export enum CurrentView { export enum CurrentView {
StartingPoint = 0, StartingPoint = 'startingPoint',
} }
export const initialState: AppState = { export const initialState: AppState = {

View file

@ -0,0 +1 @@
<p>starting-point works!</p>

View file

@ -0,0 +1,10 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
@Component({
selector: 'app-starting-point',
imports: [],
templateUrl: './starting-point.html',
styleUrl: './starting-point.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class StartingPoint {}