3
我有一個組件及其HTML文件。如何在Angular2的視圖中添加沒有組件的HTML部分
組分:
你好-world.component.ts
import {Component} from 'angular2/core';
@Component({
selector: 'hello-world',
templateUrl: 'hello-world.html'
})
export class HelloWorld {
yourName: string = '';
}
模板:
你好-world.html:
<label>Name:</label>
<h1>Hello {{yourName}}!</h1>
現在,我有其它的HTML template.html
它沒有組件,例如它包含
template.html
<h1>Welcome to template file</h1>
<p> This is an example file </p>
現在,我想包括template.html
文件中hello-world.html
。我怎樣才能做到這一點。
在Angular1我用來做什麼,
<div ng-include src="'template.html'"></div>
我怎樣才能做到這一點在Angular2?我對Angular2非常陌生。
我在很多地方搜索了這個問題,每個人都給出了一個包含組件的答案。但沒有得到我需要的解決方案。