diff --git a/apps/anchor-scrolling/src/app/app.component.ts b/apps/anchor-scrolling/src/app/app.component.ts
index 3d1b969..5a930fb 100644
--- a/apps/anchor-scrolling/src/app/app.component.ts
+++ b/apps/anchor-scrolling/src/app/app.component.ts
@@ -1,19 +1,10 @@
import { Component } from '@angular/core';
-import { AnchorButtonComponent } from './anchor-button.component';
+import { RouterOutlet } from '@angular/router';
@Component({
standalone: true,
- imports: [AnchorButtonComponent],
+ imports: [RouterOutlet],
selector: 'app-root',
- template: `
-
- Empty
-
Scroll Bottom
-
-
- I want to scroll each
-
Scroll Top
-
- `,
+ template: ` `,
})
export class AppComponent {}
diff --git a/apps/anchor-scrolling/src/app/app.routes.ts b/apps/anchor-scrolling/src/app/app.routes.ts
index 8762dfe..e73bb03 100644
--- a/apps/anchor-scrolling/src/app/app.routes.ts
+++ b/apps/anchor-scrolling/src/app/app.routes.ts
@@ -1,3 +1,9 @@
import { Route } from '@angular/router';
+import { FooComponent } from './foo.component';
+import { HomeComponent } from './home.component';
-export const appRoutes: Route[] = [];
+export const appRoutes: Route[] = [
+ { path: 'home', component: HomeComponent },
+ { path: 'foo', component: FooComponent },
+ { path: '**', redirectTo: 'home' },
+];
diff --git a/apps/anchor-scrolling/src/app/foo.component.ts b/apps/anchor-scrolling/src/app/foo.component.ts
new file mode 100644
index 0000000..a5109a8
--- /dev/null
+++ b/apps/anchor-scrolling/src/app/foo.component.ts
@@ -0,0 +1,15 @@
+import { Component } from '@angular/core';
+import { NavButtonComponent } from './nav-button.component';
+
+@Component({
+ standalone: true,
+ imports: [NavButtonComponent],
+ selector: 'app-foo',
+ template: `
+ Welcome to foo page
+ Home Page
+ section 1
+ section 2
+ `,
+})
+export class FooComponent {}
diff --git a/apps/anchor-scrolling/src/app/home.component.ts b/apps/anchor-scrolling/src/app/home.component.ts
new file mode 100644
index 0000000..836a198
--- /dev/null
+++ b/apps/anchor-scrolling/src/app/home.component.ts
@@ -0,0 +1,20 @@
+import { Component } from '@angular/core';
+import { NavButtonComponent } from './nav-button.component';
+
+@Component({
+ standalone: true,
+ imports: [NavButtonComponent],
+ selector: 'app-home',
+ template: `
+ Foo Page
+
+ Empty
+ Scroll Bottom
+
+
+ I want to scroll each
+ Scroll Top
+
+ `,
+})
+export class HomeComponent {}
diff --git a/apps/anchor-scrolling/src/app/anchor-button.component.ts b/apps/anchor-scrolling/src/app/nav-button.component.ts
similarity index 58%
rename from apps/anchor-scrolling/src/app/anchor-button.component.ts
rename to apps/anchor-scrolling/src/app/nav-button.component.ts
index d8d6c19..9e3b6d4 100644
--- a/apps/anchor-scrolling/src/app/anchor-button.component.ts
+++ b/apps/anchor-scrolling/src/app/nav-button.component.ts
@@ -1,12 +1,10 @@
/* eslint-disable @angular-eslint/component-selector */
import { Component, Input } from '@angular/core';
-import { RouterLinkWithHref } from '@angular/router';
@Component({
- selector: 'anchor-button',
+ selector: 'nav-button',
standalone: true,
- imports: [RouterLinkWithHref],
template: `
-
+
`,
@@ -14,6 +12,6 @@ import { RouterLinkWithHref } from '@angular/router';
class: 'block w-fit border border-red-500 rounded-md p-4 m-2',
},
})
-export class AnchorButtonComponent {
- @Input() href = '#top';
+export class NavButtonComponent {
+ @Input() href = '';
}
diff --git a/apps/anchor-scrolling/src/main.ts b/apps/anchor-scrolling/src/main.ts
index 544a349..3420d15 100644
--- a/apps/anchor-scrolling/src/main.ts
+++ b/apps/anchor-scrolling/src/main.ts
@@ -1,11 +1,8 @@
import { bootstrapApplication } from '@angular/platform-browser';
-import {
- provideRouter,
- withEnabledBlockingInitialNavigation,
-} from '@angular/router';
+import { provideRouter } from '@angular/router';
import { AppComponent } from './app/app.component';
import { appRoutes } from './app/app.routes';
bootstrapApplication(AppComponent, {
- providers: [provideRouter(appRoutes, withEnabledBlockingInitialNavigation())],
+ providers: [provideRouter(appRoutes)],
}).catch((err) => console.error(err));