Nativescript 在HtmlView中处理链接打开事件
我有一个html代码,里面有一个链接。下面的代码是我的模板:Nativescript 在HtmlView中处理链接打开事件,nativescript,Nativescript,我有一个html代码,里面有一个链接。下面的代码是我的模板: <HtmlView [html]="htmlString" ></HtmlView> 这是我的组件: import { Component } from "@angular/core"; @Component({ moduleId: module.id, templateUrl: "./creating-htmlview.component.html" }) export class
<HtmlView [html]="htmlString" ></HtmlView>
这是我的组件:
import { Component } from "@angular/core";
@Component({
moduleId: module.id,
templateUrl: "./creating-htmlview.component.html"
})
export class CreatingHtmlViewExampleComponent {
public htmlString: string;
constructor() {
this.htmlString = '<a href="http://google.com/">google</a>';
}
}
从“@angular/core”导入{Component};
@组成部分({
moduleId:module.id,
templateUrl:“./creating htmlview.component.html”
})
导出类创建HtmlViewExampleComponent{
公共htmlString:字符串;
构造函数(){
this.htmlString='';
}
}
当HtmlView运行时,如何处理它内部的
元素?有一种方法可以检测用户何时运行链接?目前还不支持这种方法,但存在一个。您可以编写一个插件,实现ClickableSpan或Linkify等本机API