Skip to content

Commit 82535ac

Browse files
authoredJan 26, 2024
docs: refactor docs app (#272)
1 parent 9bd90a5 commit 82535ac

File tree

9 files changed

+87
-166
lines changed

9 files changed

+87
-166
lines changed
 

‎.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ yarn-error.log
3636
/libpeerconnection.log
3737
testem.log
3838
/typings
39+
/.nx
3940

4041
# System files
4142
.DS_Store

‎projects/angular-intl-demo/src/app/app-routing.module.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { Component } from '@angular/core';
2-
import { MatButtonModule } from '@angular/material/button';
3-
import { MatToolbarModule } from '@angular/material/toolbar';
2+
import { MatButton } from '@angular/material/button';
3+
import { MatToolbar } from '@angular/material/toolbar';
44
import { RouterLink, RouterOutlet } from '@angular/router';
55

66
@Component({
77
selector: 'app-root',
88
templateUrl: './app.component.html',
99
styleUrls: ['./app.component.scss'],
1010
standalone: true,
11-
imports: [MatToolbarModule, MatButtonModule, RouterLink, RouterOutlet],
11+
imports: [RouterLink, RouterOutlet, MatToolbar, MatButton],
1212
})
1313
export class AppComponent {}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Routes } from '@angular/router';
2+
import { GettingStartedComponent } from './getting-started/getting-started.component';
3+
4+
export const routes: Routes = [
5+
{
6+
path: '',
7+
component: GettingStartedComponent,
8+
},
9+
{
10+
path: 'pipes',
11+
loadComponent: () => import('./pipes/pipes.component'),
12+
loadChildren: () => import('./pipes/pipes.routes'),
13+
},
14+
{
15+
path: '**',
16+
redirectTo: '/',
17+
},
18+
];

‎projects/angular-intl-demo/src/app/pipes/pipes-routing.module.ts

Lines changed: 0 additions & 68 deletions
This file was deleted.
Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import { Component } from '@angular/core';
22
import { MatTabsModule } from '@angular/material/tabs';
3-
import {
4-
ActivatedRoute,
5-
RouterLink,
6-
RouterLinkActive,
7-
RouterOutlet,
8-
} from '@angular/router';
3+
import { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
94

105
@Component({
116
selector: 'app-pipes',
@@ -14,6 +9,4 @@ import {
149
standalone: true,
1510
imports: [MatTabsModule, RouterLink, RouterLinkActive, RouterOutlet],
1611
})
17-
export class PipesComponent {
18-
constructor(readonly route: ActivatedRoute) {}
19-
}
12+
export default class PipesComponent {}

‎projects/angular-intl-demo/src/app/pipes/pipes.module.ts

Lines changed: 0 additions & 45 deletions
This file was deleted.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { Routes } from '@angular/router';
2+
import { CountryComponent } from './country/country.component';
3+
import { CurrencyComponent } from './currency/currency.component';
4+
import { DateComponent } from './date/date.component';
5+
import { DecimalComponent } from './decimal/decimal.component';
6+
import { LanguageComponent } from './language/language.component';
7+
import { ListComponent } from './list/list.component';
8+
import { PercentComponent } from './percent/percent.component';
9+
import { RelativeTimeComponent } from './relative-time/relative-time.component';
10+
import { UnitComponent } from './unit/unit.component';
11+
12+
const routes: Routes = [
13+
{
14+
path: 'date',
15+
component: DateComponent,
16+
},
17+
{
18+
path: 'decimal',
19+
component: DecimalComponent,
20+
},
21+
{
22+
path: 'percent',
23+
component: PercentComponent,
24+
},
25+
{
26+
path: 'currency',
27+
component: CurrencyComponent,
28+
},
29+
{
30+
path: 'unit',
31+
component: UnitComponent,
32+
},
33+
{
34+
path: 'language',
35+
component: LanguageComponent,
36+
},
37+
{
38+
path: 'country',
39+
component: CountryComponent,
40+
},
41+
{
42+
path: 'list',
43+
component: ListComponent,
44+
},
45+
{
46+
path: 'relative-time',
47+
component: RelativeTimeComponent,
48+
},
49+
{
50+
path: '',
51+
redirectTo: 'date',
52+
pathMatch: 'full',
53+
},
54+
];
55+
56+
export default routes;

‎projects/angular-intl-demo/src/main.ts

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,25 @@
1-
import {
2-
provideHttpClient,
3-
withInterceptorsFromDi,
4-
} from '@angular/common/http';
1+
import { provideHttpClient } from '@angular/common/http';
52
import { importProvidersFrom } from '@angular/core';
6-
import { MatButtonModule } from '@angular/material/button';
73
import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
8-
import { MatToolbarModule } from '@angular/material/toolbar';
9-
import { BrowserModule, bootstrapApplication } from '@angular/platform-browser';
4+
import { bootstrapApplication } from '@angular/platform-browser';
105
import { provideAnimations } from '@angular/platform-browser/animations';
6+
import { provideRouter } from '@angular/router';
117
import { MarkdownModule } from 'ngx-markdown';
12-
import { AppRoutingModule } from './app/app-routing.module';
138
import { AppComponent } from './app/app.component';
9+
import { routes } from './app/app.routes';
1410

1511
bootstrapApplication(AppComponent, {
1612
providers: [
17-
importProvidersFrom(
18-
BrowserModule,
19-
AppRoutingModule,
20-
MarkdownModule.forRoot(),
21-
MatToolbarModule,
22-
MatButtonModule,
23-
),
13+
importProvidersFrom(MarkdownModule.forRoot()),
2414
{
2515
provide: MAT_FORM_FIELD_DEFAULT_OPTIONS,
2616
useValue: {
2717
subscriptSizing: 'dynamic',
2818
},
2919
},
3020
provideAnimations(),
31-
provideHttpClient(withInterceptorsFromDi()),
21+
provideHttpClient(),
22+
provideRouter(routes),
3223
],
3324
}).catch((err) => {
3425
console.error(err);

0 commit comments

Comments
 (0)
Please sign in to comment.