I have created a project using angular-cli
which contains AppComponent as follows:
import { Component } from \'@angular/core\';
worked with angular 6
import { Component, Input } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-root',
template: `
`,
styleUrls: ['./app.component.css']
})
export class AppComponent {
private myTemplate: any = '';
constructor(http: HttpClient) {
http.get('/service-path', {responseType: 'text'}).subscribe(data => this.myTemplate = data);
}
}