Angular2桶。在同一文件夹中使用index.ts

时间:2016-09-03 01:35:21

标签: angular

RC5。我在我的"folder1"文件夹中创建了index.ts,它导出了一些类。 从位于“folder2”export {...} from '../folder1';的组件中导出它可以正常工作。

现在,在位于同一“folder1”文件夹中的组件中,我找不到任何从同一index.ts导出的方法。像export {...} from './';这样的东西是有道理的,实际上打字稿编译器就好了,但是在执行时我会遇到一些奇怪的错误:

(index):28 Error: (SystemJS) Unexpected value 'undefined' declared by the module 'AppModule'
    Error: Unexpected value 'undefined' declared by the module 'AppModule'
        at new BaseException (http://localhost:60068/libs/js/@angular/compiler/src/facade/exceptions.js:27:23)
        at eval (http://localhost:60068/libs/js/@angular/compiler/src/metadata_resolver.js:287:31)
        at Array.forEach (native)
        at CompileMetadataResolver.getNgModuleMetadata (http://localhost:60068/libs/js/@angular/compiler/src/metadata_resolver.js:285:49)
        at RuntimeCompiler._compileComponents (http://localhost:60068/libs/js/@angular/compiler/src/runtime_compiler.js:150:47)
        at RuntimeCompiler._compileModuleAndComponents (http://localhost:60068/libs/js/@angular/compiler/src/runtime_compiler.js:72:37)
        at RuntimeCompiler.compileModuleAsync (http://localhost:60068/libs/js/@angular/compiler/src/runtime_compiler.js:49:21)
        at PlatformRef_._bootstrapModuleWithZone (http://localhost:60068/libs/js/@angular/core/src/application_ref.js:368:25)
        at PlatformRef_.bootstrapModule (http://localhost:60068/libs/js/@angular/core/src/application_ref.js:361:21)
        at Object.eval (http://localhost:60068/scripts/boot.js:8:53)
    Evaluating http://localhost:60068/scripts/boot.js
    Error loading http://localhost:60068/scripts/boot.js(anonymous function) @ (index):28e.invoke @ zone.min.js:1e.run @ zone.min.js:1(anonymous function) @ zone.min.js:1e.invokeTask @ zone.min.js:1e.runTask @ zone.min.js:1a @ zone.min.js:1invoke @ zone.min.js:1

0 个答案:

没有答案