angular: Using module.id with component makes it not load
I am trying the ‘hero’ example on angular.io and using JSPM to load my scripts (non-bundled).
To get relative urls for my templates, i tried the method in #2383 and added moduleId: module.id
to my component.
import {Component} from 'angular2/core';
import {Hero} from "./hero";
@Component({
selector: 'my-hero-detail',
inputs: ['hero'],
moduleId: module.id,
templateUrl:'heroes.html'
})
However, doing so and then running the app, makes the html stuck at ‘Loading…’ with no errors in the console.
Screenshot:
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 19 (3 by maintainers)
module.id
is provided by the commonjs module. So you have to set thecompilerOptions.module
in your tsconfig.json tocommonjs
in order to activate the relative paths feature. With JSPM and Typescript you can set the"module": "commonjs"
property in thetypescriptOptions
of the typescript plugin.https://angular.io/docs/ts/latest/cookbook/component-relative-paths.html
It seems like even the “module”: “commonjs” option in place the issue still exists when bundling with systemjs-builder.