需求:
我们需要在一个新窗口中打开一个php页面。我们已经按照以下方式实现:
.html代码
<a target="_blank" href="{{pdf}}">Download Pdf</a>
.ts 代码
ngOnInit()
{
this.loggedinuser = localStorage.getItem("USERNAME");
console.log(this.loggedinuser);
this.pdf = 'http://219.90.67.154/report-service/quicktask/TCPDF/examples/test-tcpdf.php?loggedinuser='+this.loggedinuser;
}
但我们希望以不同的方式实现它。需要从html中点击一个按钮,这将调用一个函数,从这个函数中应该发生一切。
.html
<button ion-button (click)="saveit">Save</button>
.ts
saveit(){
// the url,html tag should be called from here , how ?
}