-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate to standalone component
- Loading branch information
Showing
29 changed files
with
121 additions
and
217 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
apps/angular/31-module-to-standalone/src/app/app.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
apps/angular/31-module-to-standalone/src/app/app.module.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; | ||
import { AppModule } from './app/app.module'; | ||
import appRoutes from '@angular-challenges/module-to-standalone/shell'; | ||
import { importProvidersFrom } from '@angular/core'; | ||
import { bootstrapApplication, BrowserModule } from '@angular/platform-browser'; | ||
import { provideRouter } from '@angular/router'; | ||
import { AppComponent } from './app/app.component'; | ||
|
||
platformBrowserDynamic() | ||
.bootstrapModule(AppModule) | ||
.catch((err) => console.error(err)); | ||
bootstrapApplication(AppComponent, { | ||
providers: [importProvidersFrom(BrowserModule), provideRouter(appRoutes)], | ||
}).catch((err) => console.error(err)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from './lib/admin-feature.module'; | ||
export { default } from './lib/admin-feature.routes'; |
27 changes: 0 additions & 27 deletions
27
libs/module-to-standalone/admin/feature/src/lib/admin-feature.module.ts
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
libs/module-to-standalone/admin/feature/src/lib/admin-feature.routes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Route } from '@angular/router'; | ||
|
||
export const ADMIN_FEATURE_ROUTES: Route[] = [ | ||
{ | ||
path: '', | ||
loadComponent: () => | ||
import('./dashboard/dashboard.component').then( | ||
(c) => c.DashboardComponent, | ||
), | ||
}, | ||
{ | ||
path: 'create-user', | ||
loadComponent: () => | ||
import('./create-user/create-user.component').then( | ||
(c) => c.CreateUserComponent, | ||
), | ||
}, | ||
]; | ||
|
||
export default ADMIN_FEATURE_ROUTES; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from './lib/forbidden.module'; | ||
export { default } from './lib/forbidden.component'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
libs/module-to-standalone/forbidden/src/lib/forbidden.module.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from './lib/home.module'; | ||
export { default } from './lib/home.component'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export * from './lib/main-shell.module'; | ||
import { appRoutes } from './lib/main-shell.routes'; | ||
|
||
export default appRoutes; |
11 changes: 0 additions & 11 deletions
11
libs/module-to-standalone/shell/src/lib/main-shell.module.ts
This file was deleted.
Oops, something went wrong.
58 changes: 29 additions & 29 deletions
58
libs/module-to-standalone/shell/src/lib/main-shell.routes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
import { IsAuthorizedGuard } from '@angular-challenges/module-to-standalone/admin/shared'; | ||
import { provideToken } from '@angular-challenges/module-to-standalone/core/providers'; | ||
import { Route } from '@angular/router'; | ||
|
||
export const appRoutes: Route[] = [ | ||
{ path: '', redirectTo: 'home', pathMatch: 'full' }, | ||
{ | ||
path: 'home', | ||
loadChildren: () => | ||
import('@angular-challenges/module-to-standalone/home').then( | ||
(m) => m.ModuleToStandaloneHomeModule, | ||
), | ||
}, | ||
{ | ||
path: 'admin', | ||
canActivate: [IsAuthorizedGuard], | ||
loadChildren: () => | ||
import('@angular-challenges/module-to-standalone/admin/feature').then( | ||
(m) => m.AdminFeatureModule, | ||
), | ||
}, | ||
{ | ||
path: 'user', | ||
loadChildren: () => | ||
import('@angular-challenges/module-to-standalone/user/shell').then( | ||
(m) => m.UserShellModule, | ||
), | ||
}, | ||
|
||
{ | ||
path: 'forbidden', | ||
loadChildren: () => | ||
import('@angular-challenges/module-to-standalone/forbidden').then( | ||
(m) => m.ForbiddenModule, | ||
), | ||
path: '', | ||
providers: [provideToken('main-shell-token')], | ||
children: [ | ||
{ path: '', redirectTo: 'home', pathMatch: 'full' }, | ||
{ | ||
path: 'home', | ||
loadComponent: () => | ||
import('@angular-challenges/module-to-standalone/home'), | ||
}, | ||
{ | ||
path: 'admin', | ||
canActivate: [IsAuthorizedGuard], | ||
loadChildren: () => | ||
import('@angular-challenges/module-to-standalone/admin/feature'), | ||
}, | ||
{ | ||
path: 'user', | ||
loadChildren: () => | ||
import('@angular-challenges/module-to-standalone/user/shell').then( | ||
(r) => r.default, | ||
), | ||
}, | ||
{ | ||
path: 'forbidden', | ||
loadComponent: () => | ||
import('@angular-challenges/module-to-standalone/forbidden'), | ||
}, | ||
], | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from './lib/contact-feature.module'; | ||
export { default } from './lib/contact.routes'; |
27 changes: 0 additions & 27 deletions
27
libs/module-to-standalone/user/contact/src/lib/contact-feature.module.ts
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
libs/module-to-standalone/user/contact/src/lib/contact.routes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Route } from '@angular/router'; | ||
|
||
export const CONTACT_ROUTES: Route[] = [ | ||
{ | ||
path: '', | ||
loadComponent: () => | ||
import('./dashboard/dashboard.component').then( | ||
(c) => c.ContactDashboardComponent, | ||
), | ||
}, | ||
{ | ||
path: 'create-contact', | ||
loadComponent: () => | ||
import('./create-contact/create-contact.component').then( | ||
(c) => c.CreateContactComponent, | ||
), | ||
}, | ||
]; | ||
|
||
export default CONTACT_ROUTES; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from './lib/home.module'; | ||
export { default } from './lib/home.component'; |
Oops, something went wrong.