From: Bastian Dehn Date: Fri, 10 Jun 2022 19:08:53 +0000 (+0200) Subject: add: create html titles X-Git-Tag: v1.0^2~5^2~6 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=838923cd04c27c83d305e74fbe2c388654293f66;p=speisekarten-editor.git add: create html titles --- diff --git a/src/app/html-export.service.ts b/src/app/html-export.service.ts index 9a67f22..8d2d2d9 100644 --- a/src/app/html-export.service.ts +++ b/src/app/html-export.service.ts @@ -2,6 +2,9 @@ import { Injectable } from '@angular/core'; import { DomSanitizer, SafeUrl } from '@angular/platform-browser'; import { Observable } from 'rxjs'; import { IFoodCard } from './ifood-card'; +import { ITitle } from './ititle'; +import { ISubtitle } from './isubtitle'; +import { IFood } from './ifood'; @Injectable({ providedIn: 'root' @@ -14,11 +17,24 @@ export class HtmlExportService public exportHtml(foodcard: IFoodCard): Observable { let observ = new Observable((observ) => { - let html: string = 'Speisekarte'; + let html: string = 'Speisekarte'; + html += this.createHtmlTitles(foodcard.Titles); + html += ''; let result = this.sanitizer.bypassSecurityTrustUrl("data:text/html;charset=UTF-8," + html); observ.next(result); }); return observ; } + + private createHtmlTitles(titles: ITitle[]): string + { + let titlestring = ""; + + for (let i = 0; i < titles.length; i++) { + titlestring += '

' + titles[i].Title + '

'; + } + + return titlestring; + } }