Requirement:
We need to open a php page on a new window. We have achieved like this way as shown below
.html code
<a target="_blank" href="{{pdf}}">Download Pdf</a>
.ts code
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;
}
But we want to achieve it differently. Need to click a button from html, which will call a function, from this function everything should happen.
.html
<button ion-button (click)="saveit">Save</button>
.ts
saveit(){
// the url,html tag should be called from here , how ?
}
You need to use window.open
method of javascript to open URL on button click, like this -
<button ion-button (click)="saveit()">Save</button>
saveit(){
// the url,html tag should be called from here , how ?
window.open(URL);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With