Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

docs(router): Removed references to deprecated router #1834

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ <h1>{{title}}</h1>
<h3>Routed Movies</h3>
<nav>
<!-- #docregion router-link -->
<a [routerLink]="['Movies']">Movies</a>
<a [routerLink]="['/movies']">Movies</a>
<!-- #enddocregion router-link -->
</nav>
<router-outlet></router-outlet>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from '@angular/router-deprecated';
import { ROUTER_DIRECTIVES } from '@angular/router';

import { MovieListComponent } from './movie-list.component';
import { MovieService } from './movie.service';
Expand All @@ -12,11 +12,8 @@ import { StringSafeDatePipe } from './date.pipe';
styleUrls: ['app/app.component.css'],
directives: [MovieListComponent, ROUTER_DIRECTIVES],
pipes: [StringSafeDatePipe],
providers: [MovieService, ROUTER_PROVIDERS]
providers: [MovieService]
})
@RouteConfig([
{path: '/movies', name: 'Movies', component: MovieListComponent, useAsDefault: true}
])
export class AppComponent {

angularDocsUrl = 'https://angular.io/';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// #docregion
import { provideRouter, RouterConfig } from '@angular/router';

import { MovieListComponent } from './movie-list.component';

const routes: RouterConfig = [
{ path: '', redirectTo: '/movies', pathMatch: 'full' },
{ path: 'movies', component: MovieListComponent }
];

export const appRouterProviders = [
provideRouter(routes)
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// #docregion
import { bootstrap } from '@angular/platform-browser-dynamic';
import { AppComponent } from './app.component';

bootstrap(AppComponent);
6 changes: 4 additions & 2 deletions public/docs/_examples/cb-a1-a2-quick-reference/ts/app/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// #docregion
import { bootstrap } from '@angular/platform-browser-dynamic';

import { AppComponent } from './app.component';
import { appRouterProviders } from './app.routes';

bootstrap(AppComponent);
bootstrap(AppComponent, [
appRouterProviders
]);
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// #docplaster
// #docregion import
import { Component } from '@angular/core';
import { ROUTER_DIRECTIVES } from '@angular/router-deprecated';
// #enddocregion import
import { MovieService } from './movie.service';
import { IMovie } from './movie';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { provideRouter, RouterConfig } from '@angular/router';

const routes: RouterConfig = [];

export const appRouterProviders = [
provideRouter(routes)
];
8 changes: 4 additions & 4 deletions public/docs/_examples/cb-dependency-injection/ts/app/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// #docregion
import { bootstrap } from '@angular/platform-browser-dynamic';
import { XHRBackend } from '@angular/http';
import { ROUTER_PROVIDERS } from '@angular/router-deprecated';
import { bootstrap } from '@angular/platform-browser-dynamic';
import { XHRBackend } from '@angular/http';
import { appRouterProviders } from './app.routes';
import { LocationStrategy,
HashLocationStrategy } from '@angular/common';

Expand All @@ -13,7 +13,7 @@ import { AppComponent } from './app.component';

// #docregion bootstrap
bootstrap(AppComponent, [
ROUTER_PROVIDERS,
appRouterProviders,
{ provide: LocationStrategy, useClass: HashLocationStrategy },

{ provide: XHRBackend, useClass: InMemoryBackendService }, // in-mem server
Expand Down
42 changes: 0 additions & 42 deletions public/docs/_examples/router/ts/app/app.component.5.ts

This file was deleted.

2 changes: 1 addition & 1 deletion public/docs/_examples/router/ts/app/app.routes.1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { HeroDetailComponent } from './heroes/hero-detail.component';

// #docregion
// #docregion route-config
export const routes: RouterConfig = [
const routes: RouterConfig = [
// #docregion route-defs
{ path: 'crisis-center', component: CrisisCenterComponent },
{ path: 'heroes', component: HeroListComponent },
Expand Down
2 changes: 1 addition & 1 deletion public/docs/_examples/router/ts/app/app.routes.2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { CrisisListComponent } from './crisis-list.component';
import { HeroListComponent } from './hero-list.component';

// #docregion route-config
export const routes: RouterConfig = [
const routes: RouterConfig = [
{ path: 'crisis-center', component: CrisisListComponent },
{ path: 'heroes', component: HeroListComponent }
];
Expand Down
2 changes: 1 addition & 1 deletion public/docs/_examples/style-guide/ts/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ const routes: RouterConfig = [
{ path: '09-01', component: S0901 },
];

export const APP_ROUTER_PROVIDERS = [
export const appRouterProviders = [
provideRouter(routes)
];
4 changes: 2 additions & 2 deletions public/docs/_examples/style-guide/ts/app/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { HashLocationStrategy, LocationStrategy } from '@angular/common';
import { InMemoryBackendService, SEED_DATA } from 'angular2-in-memory-web-api';
import 'rxjs/add/operator/map';

import { APP_ROUTER_PROVIDERS } from './app.routes';
import { appRouterProviders } from './app.routes';
import { HeroData } from './hero-data';
import { AppComponent } from './app.component';

bootstrap(AppComponent, [
APP_ROUTER_PROVIDERS,
appRouterProviders,
HTTP_PROVIDERS,
{ provide: LocationStrategy, useClass: HashLocationStrategy },
{ provide: XHRBackend, useClass: InMemoryBackendService },
Expand Down
4 changes: 2 additions & 2 deletions public/docs/_examples/toh-5/ts/app/app.routes.1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { HeroesComponent } from './heroes.component';
import { HeroDetailComponent } from './hero-detail.component';
// #enddocregion hero-detail-import

export const routes: RouterConfig = [
const routes: RouterConfig = [
// #docregion redirect-route
{
path: '',
Expand All @@ -32,6 +32,6 @@ export const routes: RouterConfig = [
}
];

export const APP_ROUTER_PROVIDERS = [
export const appRouterProviders = [
provideRouter(routes)
];
2 changes: 1 addition & 1 deletion public/docs/_examples/toh-5/ts/app/app.routes.2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ const routes: RouterConfig = [
}
];

export const APP_ROUTER_PROVIDERS = [
export const appRouterProviders = [
provideRouter(routes)
];
4 changes: 2 additions & 2 deletions public/docs/_examples/toh-5/ts/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { HeroesComponent } from './heroes.component';
import { HeroDetailComponent } from './hero-detail.component';
// #enddocregion hero-detail-import

export const routes: RouterConfig = [
const routes: RouterConfig = [
{
path: '',
redirectTo: '/dashboard',
Expand All @@ -27,6 +27,6 @@ export const routes: RouterConfig = [
}
];

export const APP_ROUTER_PROVIDERS = [
export const appRouterProviders = [
provideRouter(routes)
];
4 changes: 2 additions & 2 deletions public/docs/_examples/toh-5/ts/app/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { bootstrap } from '@angular/platform-browser-dynamic';

import { AppComponent } from './app.component';
import { APP_ROUTER_PROVIDERS } from './app.routes';
import { appRouterProviders } from './app.routes';

bootstrap(AppComponent, [
APP_ROUTER_PROVIDERS
appRouterProviders
]);
4 changes: 2 additions & 2 deletions public/docs/_examples/toh-6/ts/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { DashboardComponent } from './dashboard.component';
import { HeroesComponent } from './heroes.component';
import { HeroDetailComponent } from './hero-detail.component';

export const routes: RouterConfig = [
const routes: RouterConfig = [
{
path: '',
redirectTo: '/dashboard',
Expand All @@ -25,6 +25,6 @@ export const routes: RouterConfig = [
}
];

export const APP_ROUTER_PROVIDERS = [
export const appRouterProviders = [
provideRouter(routes)
];
6 changes: 3 additions & 3 deletions public/docs/_examples/toh-6/ts/app/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ import { bootstrap } from '@angular/platform-browser-dynamic';
import { HTTP_PROVIDERS } from '@angular/http';

import { AppComponent } from './app.component';
import { APP_ROUTER_PROVIDERS } from './app.routes';
import { appRouterProviders } from './app.routes';

// #enddocregion v1, final
/*
// #docregion v1
bootstrap(AppComponent, [
APP_ROUTER_PROVIDERS,
appRouterProviders,
HTTP_PROVIDERS
]);
// #enddocregion v1
*/
// #docregion final
bootstrap(AppComponent, [
APP_ROUTER_PROVIDERS,
appRouterProviders,
HTTP_PROVIDERS,
{ provide: XHRBackend, useClass: InMemoryBackendService }, // in-mem server
{ provide: SEED_DATA, useClass: InMemoryDataService } // in-mem server data
Expand Down
Loading