2017-08-01 97 views
1

我在我的app.module.ts以下代碼文件未定義導入錯誤角2 JsonpModule

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

import {AppComponent} from './app.component'; 
import {WeatherComponent} from './weather- 
widget/component/weather.component'; 

@NgModule({ 
    imports: [BrowserModule, JsonpModule], 
    declarations: [AppComponent, WeatherComponent], 
    bootstrap: [AppComponent] 
}) 

export class AppModule {} 

當我添加進口{JsonpModule}從 '@角/ HTTP';

我得到以下錯誤(不實行進口一切都很好):

(index):25 Error: (SystemJS) Unexpected value 'undefined' imported by the module 'AppModule' Error: Unexpected value 'undefined' imported by the module 'AppModule' at eval (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14331:33) at Array.forEach() at CompileMetadataResolver.getNgModuleMetadata (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14311:46) at RuntimeCompiler._compileComponents (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:17063:49) at RuntimeCompiler._compileModuleAndComponents (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:17001:39) at RuntimeCompiler.compileModuleAsync (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:16992:23) at PlatformRef_._bootstrapModuleWithZone (http://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:6684:29) at PlatformRef_.bootstrapModule (http://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:6666:25) at Object.eval (http://localhost:3000/app/main.js:5:10) at eval (http://localhost:3000/app/main.js:7:4) Evaluating http://localhost:3000/app/main.js Error loading http://localhost:3000/app/main.js at eval (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14331:33) at Array.forEach() at CompileMetadataResolver.getNgModuleMetadata (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14311:46) at RuntimeCompiler._compileComponents (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:17063:49) at RuntimeCompiler._compileModuleAndComponents (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:17001:39) at RuntimeCompiler.compileModuleAsync (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:16992:23) at PlatformRef_._bootstrapModuleWithZone (http://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:6684:29) at PlatformRef_.bootstrapModule (http://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:6666:25) at Object.eval (http://localhost:3000/app/main.js:5:10) at eval (http://localhost:3000/app/main.js:7:4) Evaluating http://localhost:3000/app/main.js Error loading http://localhost:3000/app/main.js

我已閱讀上可能出現的問題多種解決方案,但沒有成功。任何建議,將不勝感激。

回答

0

我找到了原因。我在systemjs.config.js文件中有一個錯誤。 @角度/ http映射在url中有錯誤。