File
Implements
Metadata
selector |
tc-tibco-cloud-help-archive |
styleUrls |
./tibco-cloud-help-archive.component.css |
templateUrl |
./tibco-cloud-help-archive.component.html |
Index
Properties
|
|
Methods
|
|
Inputs
|
|
Methods
Private
loadContent
|
loadContent(url)
|
|
Returns : Observable<any>
|
import {Component, Input, OnChanges, SimpleChanges} from '@angular/core';
import {Observable, of} from 'rxjs';
import {TcCoreCommonFunctions} from '../../common/tc-core-common-functions';
import {catchError, map} from 'rxjs/operators';
import {HttpClient} from '@angular/common/http';
import {Location} from '@angular/common';
import {DomSanitizer} from '@angular/platform-browser';
@Component({
selector: 'tc-tibco-cloud-help-archive',
templateUrl: './tibco-cloud-help-archive.component.html',
styleUrls: ['./tibco-cloud-help-archive.component.css']
})
export class TibcoCloudHelpArchiveComponent implements OnChanges {
@Input() url: string;
public article: string;
constructor(protected http: HttpClient, protected location: Location, protected sanitizer: DomSanitizer) { }
ngOnChanges(changes: SimpleChanges): void {
if (this.url) {
this.loadContent(this.url).subscribe(
next => {
this.article = next;
}
);
}
}
private loadContent(url): Observable<any> {
return this.http.get(TcCoreCommonFunctions.prepareUrlForStaticResource(this.location, url), {responseType: 'text'}).pipe(
map(cont => {
const article = this.sanitizer.bypassSecurityTrustHtml(cont);
return article;
}
),
catchError(err => {
console.warn('Help file not found: ', url);
const article = this.sanitizer.bypassSecurityTrustHtml('<p>Missing help file</p>');
return of(article);
})
);
}
}
<article class="article-container" [innerHTML]="article"></article>
.article-container {
background-color: #ebf5fb;
border-left: 2px solid #0081cb;
padding: 2px 10px;
margin: 15px 0;
}
.article-container button, .help-content .article-container html, .help-content .article-container input, .help-content .article-container select, .help-content .article-container textarea {
}
.article-container ul li {
font-size: 14px;
list-style: disc;
margin: 0;
margin-left: 35px;
}
.article-container ol li {
font-size: 14px;
margin: 0;
margin-left: 16px;
list-style: decimal;
}
.article-container p {
font-size: 14px;
}
Legend
Html element with directive