0

I am getting strange error 404 not found error . I have properly installed angular2-mdl with npm install angular2-mdl --save and I can find it easily inside in node_modules directory

here is my app.module.ts

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import {HttpModule} from '@angular/http';
import {FormsModule} from '@angular/forms';
import {MdlModule} from 'angular2-mdl';
import {AppComponent} from './app.component';
import {TasksComponent} from './components/tasks/tasks.component';

@NgModule({
  imports:      [ BrowserModule,HttpModule,FormsModule,MdlModule ],
  declarations: [AppComponent, TasksComponent],
  bootstrap: [AppComponent]
})
export class AppModule { }

I also want to mention that when it run npm start I get no error.

But when I run in browser I get 404 error and in console I can see it is pointing towards http://localhost:3000/angular2-mdl and I know it should be http://localhost:3000/node_modules/angular2-mdl I don't know why it is happening .

How to fix this error

Please comment if more info is required

Patata
  • 273
  • 3
  • 18

1 Answers1

0

After debugging in several ways I found the error was in systemjs.config.js

I have to add

map: {
  // our app is within the app folder
  app: 'app',
  // angular bundles
  'angular2-mdl': 'npm:angular2-mdl/bundle/angular2-mdl.js', //added this
  // other libraries

},
Patata
  • 273
  • 3
  • 18