Reputation: 326
When i use templateUrl
in @Component
I get the following error in browser console.
@Component({
selector: 'http-app',
directives: [
],
templateUrl: "app.html",
})
class HttpApp {
}
Error: Uncaught (in promise): Failed to load app.html
resolvePromise@http://localhost:8080/vendor.js:6504:33 makeResolver/<@http://localhost:8080/vendor.js:6481:15 ApplicationRef_http://localhost:8080/common.js:9943:26 [616]/http://localhost:8080/vendor.js:6289:21 NgZoneImpl/this.inner<.onInvoke@http://localhost:8080/common.js:10351:33 [616]/http://localhost:8080/vendor.js:6288:21 [616]/http://localhost:8080/vendor.js:6182:26 scheduleResolveOrReject/<@http://localhost:8080/vendor.js:6537:54 [616]/http://localhost:8080/vendor.js:6322:25 NgZoneImpl/this.inner<.onInvokeTask@http://localhost:8080/common.js:10342:33 [616]/http://localhost:8080/vendor.js:6321:25 [616]/http://localhost:8080/vendor.js:6222:30 drainMicroTaskQueue@http://localhost:8080/vendor.js:6440:27 ZoneTask/this.invoke@http://localhost:8080/vendor.js:6392:23
Project arh.:
Test
-app
--css
--img
--ts
---components
----login
-----login.ts
-----login.html
----services
---app.ts
---app.html
---vendor.ts
--index.html
Upvotes: 4
Views: 1312
Reputation: 202296
According to your error, it seems that the path to your template in the templateUrl
attribute isn't correct.
Note that such paths are relative to the root of the project for styleUrl
and templateUrl
attributes.
I think that you could try something like that:
@Component({
selector: 'http-app',
directives: [
],
templateUrl: "app/app.html",
})
class HttpApp {
}
See this question for more details:
Upvotes: 1