This repository was archived by the owner on Oct 12, 2021. It is now read-only.
This repository was archived by the owner on Oct 12, 2021. It is now read-only.
'No provider for RouterOutletMap!' error on adding "@angular/router": "3.0.0-alpha.8" #87
Closed
Description
I had some working code that showed up a UI correctly. But I had all my code in the main app.component.ts (including the html with member template).
Then I included routing (@angular/router": "3.0.0-alpha.8). I did pretty much the same code as in another app with routing. However, I get the error: 'No provider for RouterOutletMap!'.
On searching I found out another person had a misconfigured webpack. I'm using system.js and mine seems to be ok.
My angular2 version is: 2.0.0-rc.3
I used ng-cli to generate both the --mobile app and the components.
My main.ts looks like this:
import { bootstrap } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppComponent, environment } from './app/';
import { APP_SHELL_RUNTIME_PROVIDERS } from '@angular/app-shell';
import { APP_ROUTER_PROVIDERS } from './app/app.routes';
if (environment.production) {
enableProdMode();
}
bootstrap(AppComponent, [
APP_SHELL_RUNTIME_PROVIDERS,
APP_ROUTER_PROVIDERS
]);
My app.component.ts is:
import { Component } from '@angular/core';
import { APP_SHELL_DIRECTIVES } from '@angular/app-shell';
import { Router, ROUTER_DIRECTIVES } from '@angular/router';
@Component({
moduleId: module.id,
selector: 'app-root',
template: `<router-outlet></router-outlet>`,
styles: [],
directives: [APP_SHELL_DIRECTIVES, ROUTER_DIRECTIVES]
})
export class AppComponent {
}
My app.routes.ts is:
import { provideRouter, RouterConfig } from '@angular/router';
import { TopicsRoutes } from './topics/topics.routes';
export const routes: RouterConfig = [
...TopicsRoutes
];
export const APP_ROUTER_PROVIDERS = [
provideRouter(routes)
];
My TopicsRoutes in topics.routes.ts is:
import { RouterConfig } from '@angular/router';
import { TopicsComponent } from './topics.component';
export const TopicsRoutes: RouterConfig = [
{ path: '', component: TopicsComponent },
{ path: 'topics', component: TopicsComponent }
];
Metadata
Metadata
Assignees
Labels
No labels