update
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { I18nService } from './../../services/i18n.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-html',
|
||||
templateUrl: './html.component.html',
|
||||
styleUrls: ['./html.component.scss']
|
||||
})
|
||||
export class HtmlComponent implements OnInit {
|
||||
|
||||
htmlTemplate: any;
|
||||
locale: String;
|
||||
@Input() template;
|
||||
|
||||
constructor(private i18n: I18nService, private httpClient: HttpClient) {
|
||||
this.locale = this.i18n.getLocale();
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
const headers = new HttpHeaders()
|
||||
.set('content-type', 'text/html');
|
||||
this.httpClient.get(
|
||||
'./assets/templates/' + this.template + (this.locale ? "." + this.locale : "") + ".html",
|
||||
{
|
||||
headers: headers,
|
||||
responseType: 'text'
|
||||
}).subscribe(response => this.htmlTemplate = response);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user