Skip to content
This repository was archived by the owner on Mar 20, 2024. It is now read-only.

Commit a35fcb4

Browse files
brandonrobertswardbell
authored andcommitted
chore(router): Added ModuleWithProviders to routing exports
closes #2113
1 parent 7972ecc commit a35fcb4

33 files changed

+89
-56
lines changed

public/docs/_examples/cb-a1-a2-quick-reference/ts/app/app.module.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22
import { NgModule } from '@angular/core';
33
import { BrowserModule } from '@angular/platform-browser';
44
import { FormsModule } from '@angular/forms';
5-
import { RouterModule } from '@angular/router';
65

76
import { AppComponent } from './app.component';
87
import { MovieListComponent } from './movie-list.component';
9-
import { routes } from './app.routes';
8+
import { routing } from './app.routing';
109

1110
@NgModule({
1211
imports: [
1312
BrowserModule,
1413
FormsModule,
15-
RouterModule.forRoot(routes, {})
14+
routing
1615
],
1716
declarations: [
1817
AppComponent,

public/docs/_examples/cb-a1-a2-quick-reference/ts/app/app.routes.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// #docregion
2+
import { ModuleWithProviders } from '@angular/core';
3+
import { Routes, RouterModule } from '@angular/router';
4+
5+
import { MovieListComponent } from './movie-list.component';
6+
7+
const routes: Routes = [
8+
{ path: '', redirectTo: '/movies', pathMatch: 'full' },
9+
{ path: 'movies', component: MovieListComponent }
10+
];
11+
12+
export const routing: ModuleWithProviders = RouterModule.forRoot(routes);

public/docs/_examples/cb-dependency-injection/ts/app/app.module.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
import { BrowserModule } from '@angular/platform-browser';
33
import { FormsModule } from '@angular/forms';
44
import { XHRBackend } from '@angular/http';
5-
// import { appRouterProviders } from './app.routes';
5+
/* import { routing,
6+
appRoutingProviders } from './app.routing';*/
67
import { LocationStrategy,
78
HashLocationStrategy } from '@angular/common';
89
import { NgModule } from '@angular/core';
@@ -51,15 +52,19 @@ const C_DIRECTIVES = [
5152

5253
// #docregion bootstrap
5354
@NgModule({
54-
imports: [ BrowserModule, FormsModule ],
55+
imports: [
56+
BrowserModule,
57+
FormsModule,
58+
// routing TODO: add routes
59+
],
5560
declarations: [ ...DIRECTIVES,
5661
...B_DIRECTIVES,
5762
...C_DIRECTIVES,
5863
AliceComponent,
5964
AlexComponent ],
6065
bootstrap: [ AppComponent ],
6166
providers: [
62-
// appRouterProviders, TODO: add routes
67+
// appRoutingProviders, TODO: add routes
6368
{ provide: LocationStrategy, useClass: HashLocationStrategy },
6469

6570
{ provide: XHRBackend, useClass: InMemoryBackendService }, // in-mem server
@@ -71,4 +76,3 @@ export class AppModule {
7176
}
7277
}
7378
// #enddocregion bootstraps
74-

public/docs/_examples/cb-dependency-injection/ts/app/app.routes.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { ModuleWithProviders } from '@angular/core';
2+
import { Routes, RouterModule } from '@angular/router';
3+
4+
const routes: Routes = [];
5+
6+
export const routing: ModuleWithProviders = RouterModule.forRoot(routes);
7+
8+
export const appRoutingProviders: any[] = [
9+
10+
];

public/docs/_examples/ngmodule/ts/app/app.routing.3.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { ModuleWithProviders } from '@angular/core';
12
import { Routes,
23
RouterModule } from '@angular/router';
34

@@ -7,4 +8,4 @@ export const routes: Routes = [
78
{ path: 'heroes', loadChildren: 'app/hero/hero.module.3' }
89
];
910

10-
export const routing = RouterModule.forRoot(routes);
11+
export const routing: ModuleWithProviders = RouterModule.forRoot(routes);

public/docs/_examples/ngmodule/ts/app/app.routing.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// #docregion
2+
import { ModuleWithProviders } from '@angular/core';
23
import { Routes,
34
RouterModule } from '@angular/router';
45

@@ -11,5 +12,5 @@ export const routes: Routes = [
1112
];
1213

1314
// #docregion forRoot
14-
export const routing = RouterModule.forRoot(routes);
15+
export const routing: ModuleWithProviders = RouterModule.forRoot(routes);
1516
// #enddocregion forRoot
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import { ModuleWithProviders } from '@angular/core';
12
import { RouterModule } from '@angular/router';
23

34
import { ContactComponent } from './contact.component.3';
45

5-
export const routing = RouterModule.forChild([
6+
export const routing: ModuleWithProviders = RouterModule.forChild([
67
{ path: 'contact', component: ContactComponent}
78
]);
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import { ModuleWithProviders } from '@angular/core';
12
import { RouterModule } from '@angular/router';
23

34
import { ContactComponent } from './contact.component';
45

56
// #docregion routing
6-
export const routing = RouterModule.forChild([
7+
export const routing: ModuleWithProviders = RouterModule.forChild([
78
{ path: 'contact', component: ContactComponent}
89
]);
910
// #enddocregion

0 commit comments

Comments
 (0)