Skip to main content
added 192 characters in body
Source Link
dewwwald
  • 297
  • 4
  • 14

Angular2 systemjs configuration fails when I add router to the config:

var map = { 'app': 'app', // 'dist', '@angular': 'core/@angular', '@angular/router': 'core/@angular/router', 'angular2-in-memory-web-api': 'core/angular2-in-memory-web-api', 'rxjs': 'core/rxjs' }; // packages tells the System loader how to load when no filename and/or no extension var packages = { 'app': { main: 'main.js', defaultExtension: 'js' }, '@angular/router': { main: 'index.js', defaultExtension: 'js' }, 'rxjs': { defaultExtension: 'js' }, 'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' }, }; 

The error is:

Error: TypeError: router_1.provideRouter is not a function(…) 

What is the proper config?


I changed the systemjs config to no longer specify router. Now I can confirm that the entire folder is being copied over.

my code in app/config/app.routes.ts is:

import { RouterConfig, provideRouter } from '@angular/router'; import { HomeComponent } from '../components/home/home.component'; export const routes: RouterConfig = [ { path: 'who', component: HomeComponent } ]; export const APP_ROUTER_PROVIDER = [ provideRouter(routes) ]; 

Then in app/main.ts I have:

import { bootstrap } from '@angular/platform-browser-dynamic'; import { LayoutComponent } from './components/layout/layout.component'; import { APP_ROUTER_PROVIDER } from './config/app.routes'; bootstrap(LayoutComponent, [ APP_ROUTER_PROVIDER ]) .catch(err => console.error(err)); 

This seem correct to me as all the tutorial code is there.

My project structure is as follow:

node_modules/ public_html/ - app/ - index.html - system.config.js typings/ tsconfig.json typings.json 

Angular2 systemjs configuration fails when I add router to the config:

var map = { 'app': 'app', // 'dist', '@angular': 'core/@angular', '@angular/router': 'core/@angular/router', 'angular2-in-memory-web-api': 'core/angular2-in-memory-web-api', 'rxjs': 'core/rxjs' }; // packages tells the System loader how to load when no filename and/or no extension var packages = { 'app': { main: 'main.js', defaultExtension: 'js' }, '@angular/router': { main: 'index.js', defaultExtension: 'js' }, 'rxjs': { defaultExtension: 'js' }, 'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' }, }; 

The error is:

Error: TypeError: router_1.provideRouter is not a function(…) 

What is the proper config?


I changed the systemjs config to no longer specify router. Now I can confirm that the entire folder is being copied over.

my code in app/config/app.routes.ts is:

import { RouterConfig, provideRouter } from '@angular/router'; import { HomeComponent } from '../components/home/home.component'; export const routes: RouterConfig = [ { path: 'who', component: HomeComponent } ]; export const APP_ROUTER_PROVIDER = [ provideRouter(routes) ]; 

Then in app/main.ts I have:

import { bootstrap } from '@angular/platform-browser-dynamic'; import { LayoutComponent } from './components/layout/layout.component'; import { APP_ROUTER_PROVIDER } from './config/app.routes'; bootstrap(LayoutComponent, [ APP_ROUTER_PROVIDER ]) .catch(err => console.error(err)); 

This seem correct to me as all the tutorial code is there.

Angular2 systemjs configuration fails when I add router to the config:

var map = { 'app': 'app', // 'dist', '@angular': 'core/@angular', '@angular/router': 'core/@angular/router', 'angular2-in-memory-web-api': 'core/angular2-in-memory-web-api', 'rxjs': 'core/rxjs' }; // packages tells the System loader how to load when no filename and/or no extension var packages = { 'app': { main: 'main.js', defaultExtension: 'js' }, '@angular/router': { main: 'index.js', defaultExtension: 'js' }, 'rxjs': { defaultExtension: 'js' }, 'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' }, }; 

The error is:

Error: TypeError: router_1.provideRouter is not a function(…) 

What is the proper config?


I changed the systemjs config to no longer specify router. Now I can confirm that the entire folder is being copied over.

my code in app/config/app.routes.ts is:

import { RouterConfig, provideRouter } from '@angular/router'; import { HomeComponent } from '../components/home/home.component'; export const routes: RouterConfig = [ { path: 'who', component: HomeComponent } ]; export const APP_ROUTER_PROVIDER = [ provideRouter(routes) ]; 

Then in app/main.ts I have:

import { bootstrap } from '@angular/platform-browser-dynamic'; import { LayoutComponent } from './components/layout/layout.component'; import { APP_ROUTER_PROVIDER } from './config/app.routes'; bootstrap(LayoutComponent, [ APP_ROUTER_PROVIDER ]) .catch(err => console.error(err)); 

This seem correct to me as all the tutorial code is there.

My project structure is as follow:

node_modules/ public_html/ - app/ - index.html - system.config.js typings/ tsconfig.json typings.json 
added 919 characters in body
Source Link
dewwwald
  • 297
  • 4
  • 14

Angular2 systemjs configuration fails when I add router to the config:

var map = { 'app': 'app', // 'dist', '@angular': 'core/@angular', '@angular/router': 'core/@angular/router', 'angular2-in-memory-web-api': 'core/angular2-in-memory-web-api', 'rxjs': 'core/rxjs' }; // packages tells the System loader how to load when no filename and/or no extension var packages = { 'app': { main: 'main.js', defaultExtension: 'js' }, '@angular/router': { main: 'index.js', defaultExtension: 'js' }, 'rxjs': { defaultExtension: 'js' }, 'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' }, }; 

The error is:

Error: TypeError: router_1.provideRouter is not a function(…) 

What is the proper config?


I changed the systemjs config to no longer specify router. Now I can confirm that the entire folder is being copied over.

my code in app/config/app.routes.ts is:

import { RouterConfig, provideRouter } from '@angular/router'; import { HomeComponent } from '../components/home/home.component'; export const routes: RouterConfig = [ { path: 'who', component: HomeComponent } ]; export const APP_ROUTER_PROVIDER = [ provideRouter(routes) ]; 

Then in app/main.ts I have:

import { bootstrap } from '@angular/platform-browser-dynamic'; import { LayoutComponent } from './components/layout/layout.component'; import { APP_ROUTER_PROVIDER } from './config/app.routes'; bootstrap(LayoutComponent, [ APP_ROUTER_PROVIDER ]) .catch(err => console.error(err)); 

This seem correct to me as all the tutorial code is there.

Angular2 systemjs configuration fails when I add router to the config:

var map = { 'app': 'app', // 'dist', '@angular': 'core/@angular', '@angular/router': 'core/@angular/router', 'angular2-in-memory-web-api': 'core/angular2-in-memory-web-api', 'rxjs': 'core/rxjs' }; // packages tells the System loader how to load when no filename and/or no extension var packages = { 'app': { main: 'main.js', defaultExtension: 'js' }, '@angular/router': { main: 'index.js', defaultExtension: 'js' }, 'rxjs': { defaultExtension: 'js' }, 'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' }, }; 

The error is:

Error: TypeError: router_1.provideRouter is not a function(…) 

What is the proper config?

Angular2 systemjs configuration fails when I add router to the config:

var map = { 'app': 'app', // 'dist', '@angular': 'core/@angular', '@angular/router': 'core/@angular/router', 'angular2-in-memory-web-api': 'core/angular2-in-memory-web-api', 'rxjs': 'core/rxjs' }; // packages tells the System loader how to load when no filename and/or no extension var packages = { 'app': { main: 'main.js', defaultExtension: 'js' }, '@angular/router': { main: 'index.js', defaultExtension: 'js' }, 'rxjs': { defaultExtension: 'js' }, 'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' }, }; 

The error is:

Error: TypeError: router_1.provideRouter is not a function(…) 

What is the proper config?


I changed the systemjs config to no longer specify router. Now I can confirm that the entire folder is being copied over.

my code in app/config/app.routes.ts is:

import { RouterConfig, provideRouter } from '@angular/router'; import { HomeComponent } from '../components/home/home.component'; export const routes: RouterConfig = [ { path: 'who', component: HomeComponent } ]; export const APP_ROUTER_PROVIDER = [ provideRouter(routes) ]; 

Then in app/main.ts I have:

import { bootstrap } from '@angular/platform-browser-dynamic'; import { LayoutComponent } from './components/layout/layout.component'; import { APP_ROUTER_PROVIDER } from './config/app.routes'; bootstrap(LayoutComponent, [ APP_ROUTER_PROVIDER ]) .catch(err => console.error(err)); 

This seem correct to me as all the tutorial code is there.

added 84 characters in body
Source Link
dewwwald
  • 297
  • 4
  • 14

Angular2 systemjs configuration fails when I add router to the config:

var map = { 'app': 'app', // 'dist', '@angular': 'core/@angular', '@angular/router': 'core/@angular/router', 'angular2-in-memory-web-api': 'core/angular2-in-memory-web-api', 'rxjs': 'core/rxjs' }; // packages tells the System loader how to load when no filename and/or no extension var packages = { 'app': { main: 'main.js', defaultExtension: 'js' }, '@angular/router': { main: 'index.js', defaultExtension: 'js' }, 'rxjs': { defaultExtension: 'js' }, 'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' }, }; 

The error is:

Error: TypeError: router_1.provideRouter is not a function(…) 

What is the proper config?

Angular2 systemjs configuration fails when I add router to the config:

var map = { 'app': 'app', // 'dist', '@angular': 'core/@angular', '@angular/router': 'core/@angular/router', 'angular2-in-memory-web-api': 'core/angular2-in-memory-web-api', 'rxjs': 'core/rxjs' }; // packages tells the System loader how to load when no filename and/or no extension var packages = { 'app': { main: 'main.js', defaultExtension: 'js' }, '@angular/router': { main: 'index.js', defaultExtension: 'js' }, 'rxjs': { defaultExtension: 'js' }, 'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' }, }; 

What is the proper config?

Angular2 systemjs configuration fails when I add router to the config:

var map = { 'app': 'app', // 'dist', '@angular': 'core/@angular', '@angular/router': 'core/@angular/router', 'angular2-in-memory-web-api': 'core/angular2-in-memory-web-api', 'rxjs': 'core/rxjs' }; // packages tells the System loader how to load when no filename and/or no extension var packages = { 'app': { main: 'main.js', defaultExtension: 'js' }, '@angular/router': { main: 'index.js', defaultExtension: 'js' }, 'rxjs': { defaultExtension: 'js' }, 'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' }, }; 

The error is:

Error: TypeError: router_1.provideRouter is not a function(…) 

What is the proper config?

Source Link
dewwwald
  • 297
  • 4
  • 14
Loading