NOTE! You are browsing legacy documentation. For latest visit docs.nativescript.org.

NativeScript Angular

Htmlview

The HtmlView represents a view with HTML content. Use this component instead of a WebView when you want to show static HTML content with base HTML support.

Image

Usage

<HtmlView [html]="htmlString" ></HtmlView>
import { Component } from "@angular/core";

@Component({
    moduleId: module.id,
    templateUrl: "./usage.component.html"
})

export class HtmlViewUsageComponent {
    public htmlString: string;

    constructor() {
        this.htmlString = `<span>
                              <h1>HtmlView demo in <font color="blue">NativeScript</font> App</h1>
                           </span>`;
    }
}

Properties

Name Type Description
html string Gets or sets the HTML string. Limited HTML support - for extended support use WebView

Events

Name Description
layoutChangedEvent String value used when hooking to layoutChanged event.
loaded String value used when hooking to loaded event.

API References

Name Type API Reference Link
HtmlView Module
HtmlView Class

Native Component

Android iOS
android.widget.TextView UILabel