Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strange behavior with loading templates by relative paths #47

Open
EslaMx7 opened this issue Jan 17, 2017 · 4 comments
Open

strange behavior with loading templates by relative paths #47

EslaMx7 opened this issue Jan 17, 2017 · 4 comments

Comments

@EslaMx7
Copy link

EslaMx7 commented Jan 17, 2017

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 ?

@cruhr
Copy link

cruhr commented Feb 6, 2017

Hey,
I got the same strange behavior today and fixed it by adding a , to the end of the line (if you don't like it in the last line of the decorator, move it in front of the selector).
It seems like there might be a regexp that specifically looks for the comma at the end of the templateUrl property.

@luchillo17
Copy link

That's a weird error that wasn't happening in version 0.6.0.

@GiuseppePiscopo
Copy link

Are this and #50 related?

@Riobe
Copy link

Riobe commented Apr 27, 2017

I think PR #67 will fix this if it's as @dac-xp says (and it looks like it based on the examples).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants