相关疑难解决方法(0)

如何在JavaScript中获取查询字符串值?

是否有一种无插件的方式通过jQuery(或没有)检索查询字符串值?

如果是这样,怎么样?如果没有,是否有插件可以这样做?

javascript url plugins query-string

2701
推荐指数
50
解决办法
359万
查看次数

单击按钮打开 url 但来自 ts 函数

要求:

我们需要在新窗口中打开一个 php 页面。我们已经这样实现了,如下所示

.html code

 <a target="_blank" href="{{pdf}}">Download Pdf</a>
Run Code Online (Sandbox Code Playgroud)

.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;
}
Run Code Online (Sandbox Code Playgroud)

但我们想以不同的方式实现它。需要从 html 中点击一个按钮,这将调用一个函数,从这个函数中一切都应该发生。

.html

 <button ion-button  (click)="saveit">Save</button>
Run Code Online (Sandbox Code Playgroud)

.ts

saveit(){
// the url,html tag should be called from here , how ?
}
Run Code Online (Sandbox Code Playgroud)

typescript ionic-framework ionic2 ionic3 angular

3
推荐指数
1
解决办法
1万
查看次数