![]() |
|
<div class="output-section"> <label>Generated HTML Preview:</label> <div class="preview" [innerHTML]="convertedHtml"></div>
import Component from '@angular/core'; import BhTextToHtmlService from '../services/bh-text-to-html.service'; import DomSanitizer, SafeHtml from '@angular/platform-browser'; @Component( selector: 'app-bh-converter', templateUrl: './bh-converter.component.html', styleUrls: ['./bh-converter.component.css'] ) export class BhConverterComponent { bhText: string = '[b]Hello Angular + Mozilla![/b]\n[i]This is BH text converted to HTML.[/i]\n[url=https://mozilla.org]Visit Mozilla[/url]'; convertedHtml: SafeHtml = ''; rawHtmlCode: string = ''; descargar bh text to html mozilla angular
// In your routing module
"scripts": [ "src/assets/libs/marked.min.js", "src/assets/libs/purify.min.js" ] But the modern Angular way is using npm and importing them into components. Now, let's create an Angular service called BhTextToHtmlService . This will handle downloading (importing) the logic and transforming text. Generated HTML Preview:<
| Â |