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
對,現在我明白了,謝謝! –