import { Component, Input, OnInit } from '@angular/core'; import { Http } from '@angular/http'; @Component({ selector: 'include-content', template: `

{{page}}

{{templateContent}}
` }) export class IncludeContentComponent implements OnInit { @Input('src') templateUrl: string; page: string; templateContent: string; constructor(private http: Http) {} ngOnInit() { this.http.get(this.templateUrl).subscribe((out: any) => { this.templateContent = out['_body']; this.page = out.url.slice(out.url.lastIndexOf('/') + 1, out.url.length); }); } }