]> juplo.de Git - demos/angular/stored-login/commitdiff
home component shows the logged in user
authorKai Moritz <kai@juplo.de>
Mon, 15 Sep 2025 20:39:06 +0000 (22:39 +0200)
committerKai Moritz <kai@juplo.de>
Mon, 15 Sep 2025 20:45:48 +0000 (22:45 +0200)
src/app/home/home.component.html
src/app/home/home.component.ts

index 5f2c53ffd520ab9f3060cebc8d9455c1c96a24b8..383f71427c10c7bdb1e551826bb33f56b939b5b3 100644 (file)
@@ -1 +1 @@
-<p>home works!</p>
+<p>hello {{ username$ | async }}!</p>
index e9285d4b22aa7656385138778aba23036395b0a9..b6a6b418789e0250a2ed86add9da7863dfe1e114 100644 (file)
@@ -1,11 +1,18 @@
 import { Component } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { Store } from '@ngrx/store';
+import { selectToken } from '../store/login.selectors';
 
 @Component({
   selector: 'app-home',
-  imports: [],
+  imports: [ CommonModule ],
   templateUrl: './home.component.html',
   styleUrl: './home.component.less'
 })
 export class HomeComponent {
+  username$;
 
+  constructor(store : Store) {
+    this.username$ = store.select(selectToken);
+  }
 }