Closed DorianGrey closed 8 years ago
With the recent merge, we're now using Typescript 2 (beta). I've implemented loading templates via plugin-text in this branch. However, we're not merging it now, since there are two problems with it:
import template from "./template.html";
. The complaint aims at a missing default export declaration, although it exists. A workaround for this is to use require
inline, like:@Component({
selector: "app",
directives: [ROUTER_DIRECTIVES],
pipes: [TranslatePipe],
styles: [styles],
template: require("./app.template.html")
})
export class App { ...}
Follow-up for the workaround in https://github.com/flaviait/ng2-jspm-template/pull/8 - atm., this works around a problem of the typescript compiler picking up files although a specialized loader is specified, causing compiler errors if there is no specific module definition. The workaround generates these definitions using the full path, which works, but is kinda... unlikely.
Corresponding issue: https://github.com/Microsoft/TypeScript/issues/6615
Properly supporting these loader-mechanisms is currently on the [roadmap for typescript v2 (https://github.com/Microsoft/TypeScript/milestones/TypeScript%202.0), and we should adopt our code once this support is available.