Skip to content

strange behavior with loading templates by relative paths #47

@EslaMx7

Description

@EslaMx7

I've got a strange behavior while loading the component template, some components works fine by using relative paths:
templateUrl: './home.component.html'
And others cannot work without specifying an absolute path:
templateUrl : '/src/app/shared/components/menu/menu.component.html'
However, they are in the same folder!
I got this error in the console:

GET http://localhost:7000/menu.component.html 404 (Not Found)
scheduleTask @ zone.js?fad3:1645
ZoneDelegate.scheduleTask @ zone.js?fad3:255
Zone.scheduleMacroTask @ zone.js?fad3:168
(anonymous) @ zone.js?fad3:1669
send @ VM11106:3
ResourceLoaderImpl.get @ platform-browser-dynamic.umd.js?04e2:55
DirectiveNormalizer._fetch @ compiler.umd.js?9df7:13541
DirectiveNormalizer.normalizeTemplateAsync @ compiler.umd.js?9df7:13587
DirectiveNormalizer.normalizeTemplate @ compiler.umd.js?9df7:13559
CompileMetadataResolver._loadDirectiveMetadata @ compiler.umd.js?9df7:17874
(anonymous) @ compiler.umd.js?9df7:18050
CompileMetadataResolver.loadNgModuleDirectiveAndPipeMetadata @ compiler.umd.js?9df7:18049
(anonymous) @ compiler.umd.js?9df7:27290
JitCompiler._loadModules @ compiler.umd.js?9df7:27289
JitCompiler._compileModuleAndComponents @ compiler.umd.js?9df7:27244
JitCompiler.compileModuleAsync @ compiler.umd.js?9df7:27210
PlatformRef_._bootstrapModuleWithZone @ core.umd.js?e2a5:8476
PlatformRef_.bootstrapModule @ core.umd.js?e2a5:8451
(anonymous) @ main.ts?7d64:7
(anonymous) @ main.ts?7d64:7
76 @ app.js:15
__webpack_require__ @ polyfills.js:51
0 @ app.js:7
__webpack_require__ @ polyfills.js:51
webpackJsonpCallback @ polyfills.js:22
(anonymous) @ app.js:1
zone.js?fad3:405 Unhandled Promise rejection: Failed to load menu.component.html ;

I'm using the latest version of everything!, So do you have explanation for this ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions