From 7b9ea1ad364bbe0adac45a16fdb88e61b159db07 Mon Sep 17 00:00:00 2001 From: Maksim Ivanov Date: Fri, 27 Sep 2024 11:36:10 +0300 Subject: [PATCH] chore(demo): use signal (#9229) --- projects/demo/src/modules/app/app.component.ts | 15 +++++++++------ projects/demo/src/modules/app/app.template.html | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/projects/demo/src/modules/app/app.component.ts b/projects/demo/src/modules/app/app.component.ts index 9aee7a5297c3..744f973f31f0 100644 --- a/projects/demo/src/modules/app/app.component.ts +++ b/projects/demo/src/modules/app/app.component.ts @@ -1,6 +1,6 @@ import type {OnInit} from '@angular/core'; import {Component, DestroyRef, inject, ViewEncapsulation} from '@angular/core'; -import {takeUntilDestroyed} from '@angular/core/rxjs-interop'; +import {takeUntilDestroyed, toSignal} from '@angular/core/rxjs-interop'; import {NavigationEnd, Router} from '@angular/router'; import {changeDetection} from '@demo/emulate/change-detection'; import {environment} from '@demo/environments/environment'; @@ -62,11 +62,14 @@ export class App extends AbstractDemo implements OnInit { protected readonly routes = DemoRoute; protected readonly playground = environment.playground; - protected readonly isLanding$ = this.router.events.pipe( - filter((event) => event instanceof NavigationEnd), - map(() => this.url === '' || this.url === '/'), - distinctUntilChanged(), - startWith(true), + protected readonly isLanding = toSignal( + this.router.events.pipe( + filter((event) => event instanceof NavigationEnd), + map(() => this.url === '' || this.url === '/'), + distinctUntilChanged(), + startWith(true), + ), + {initialValue: true}, ); public override async ngOnInit(): Promise { diff --git a/projects/demo/src/modules/app/app.template.html b/projects/demo/src/modules/app/app.template.html index d2c05f8531d3..1ccd85841fd7 100644 --- a/projects/demo/src/modules/app/app.template.html +++ b/projects/demo/src/modules/app/app.template.html @@ -1,4 +1,4 @@ - +