0
import { Component } from "angular2/core";
@Component({
selector: "header-component",
templateUrl: "header-template.html"
})
export class HeaderComponent {
}
主要成分
import {Component} from "angular2/core";
import {bootstrap} from 'angular2/platform/browser';
// Components
import { HeaderComponent } from "./header.component";
import {ParametersForm} from './form'
@Component({
selector: "my-app",
directives: [ParametersForm, HeaderComponent],
template: `
<header-component></header-component>
<parameters-form></parameters-form>
`
})
class MainApp {
}
bootstrap(MainApp)
.catch(err => console.error(err));
问题是标题,template.html没有找到
我尝试以下
templateUrl: "header-template"
templateUrl: "header-template.html"
templateUrl: "./header-template.html"
yes templa te与其他正确导入的组件位于同一文件夹中。
有人知道这里的问题吗?
没错打扰了它与首次定位。为了更好的解决问题,我不知道那是怎么做到的。谢谢您的回答! –
@PetrosKyriakou作为一个例子,这里是一个系统js的html加载器:https://github.com/Hypercubed/systemjs-plugin-html/ – basarat
对,现在我明白了,谢谢! –