mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-13 06:13:03 -05:00
feat(challengestandalone): challenge standalone
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { TOKEN } from '@angular-challenges/module-to-standalone/core/providers';
|
||||
import { Component, Inject } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'lib-user-shell',
|
||||
template: `
|
||||
-- User Panel --
|
||||
<div class="flex gap-2 items-center">
|
||||
<button
|
||||
routerLink="home"
|
||||
class="border px-4 py-2 border-blue-400 rounded-md">
|
||||
Home
|
||||
</button>
|
||||
<button
|
||||
routerLink="contact"
|
||||
class="border px-4 py-2 border-blue-400 rounded-md">
|
||||
Contact
|
||||
</button>
|
||||
More buttons ...
|
||||
</div>
|
||||
<router-outlet></router-outlet>
|
||||
<section>
|
||||
LoadedToken
|
||||
{{ token }}
|
||||
</section>
|
||||
`,
|
||||
host: {
|
||||
class: 'flex flex-col p-4 gap-3 border border-blue',
|
||||
},
|
||||
})
|
||||
export class UserShellComponent {
|
||||
constructor(@Inject(TOKEN) public token: string) {}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { provideToken } from '@angular-challenges/module-to-standalone/core/providers';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { UserShellComponent } from './user-shell.component';
|
||||
import { userShellRoutes } from './user-shell.routes';
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, RouterModule.forChild(userShellRoutes), RouterModule],
|
||||
declarations: [UserShellComponent],
|
||||
providers: [provideToken('user-token')],
|
||||
})
|
||||
export class UserShellModule {}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { Route } from '@angular/router';
|
||||
import { UserShellComponent } from './user-shell.component';
|
||||
|
||||
export const userShellRoutes: Route[] = [
|
||||
{
|
||||
path: '',
|
||||
component: UserShellComponent,
|
||||
children: [
|
||||
{ path: '', redirectTo: 'home', pathMatch: 'full' },
|
||||
{
|
||||
path: 'home',
|
||||
loadChildren: () =>
|
||||
import('@angular-challenges/module-to-standalone/user/home').then(
|
||||
(m) => m.UserHomeModule
|
||||
),
|
||||
},
|
||||
{
|
||||
path: 'contact',
|
||||
loadChildren: () =>
|
||||
import('@angular-challenges/module-to-standalone/user/contact').then(
|
||||
(m) => m.ContactFeatureModule
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user