File

C:/GoDev/src/TCSTK-Angular/projects/tibco-tcstk/tc-core-lib/src/lib/components/tibco-cloud-help-archive/tibco-cloud-help-archive.component.ts

Implements

OnChanges

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

Constructor

constructor(http: HttpClient, location: Location, sanitizer: DomSanitizer)
Parameters :
Name Type Optional
http HttpClient No
location Location No
sanitizer DomSanitizer No

Inputs

url
Type : string

Methods

Private loadContent
loadContent(url)
Parameters :
Name Optional
url No
Returns : Observable<any>
ngOnChanges
ngOnChanges(changes: SimpleChanges)
Parameters :
Name Type Optional
changes SimpleChanges No
Returns : void

Properties

Public article
Type : string
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>

./tibco-cloud-help-archive.component.css

.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
Component
Html element with directive

result-matching ""

    No results matching ""