本文整理汇总了TypeScript中@angular/http.URLSearchParams.get方法的典型用法代码示例。如果您正苦于以下问题:TypeScript URLSearchParams.get方法的具体用法?TypeScript URLSearchParams.get怎么用?TypeScript URLSearchParams.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/http.URLSearchParams
的用法示例。
在下文中一共展示了URLSearchParams.get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: URLSearchParams
this.route.fragment.subscribe((fragment: string) => {
if (fragment == undefined || fragment == "")
return;
let params = new URLSearchParams(fragment);
HttpClient.token = params.get('access_token');
let loc = params.get('status');
if (loc != undefined)
this.router.navigate([loc]);
});
示例2: scan
scan(isbn){
console.log(isbn);
// BarcodeScanner.scan().then((barcodeData) => {
// this.results=barcodeData;
// let isbn=results.text;
isbn = isbn || "9781451648546";
console.log(isbn);
var url = "https://www.googleapis.com/books/v1/volumes?q=isbn:" + isbn;
var params = new URLSearchParams(url);
let response = params.get('params');
console.log(response);
var results = JSON.parse(response);
console.log(results);
if (results) {
console.log(isbn);
var book = results.items[0];
var title = (book["volumeInfo"]["title"]);
var subtitle = (book["volumeInfo"]["subtitle"]);
var authors = (book["volumeInfo"]["authors"]);
// var printType = (book["volumeInfo"]["printType"]);
// var pageCount = (book["volumeInfo"]["pageCount"]);
// var publisher = (book["volumeInfo"]["publisher"]);
// var publishedDate = (book["volumeInfo"]["publishedDate"]);
// var webReaderLink = (book["accessInfo"]["webReaderLink"]);
console.log('title--- '+ title);
//}
// },(err) => {
// alert(`error : ${err}`);
// });
// }
}
}
示例3: constructor
constructor(private loginService: LoginService,
private router: Router,
private settings: Settings) {
this.isLoggedIn = loginService.isLoggedIn()
if (this.isLoggedIn) {
this.router.navigate(['home']);
}
else {
let params = new URLSearchParams(window.location.href);
let code = params.get(this.settings.RedirectBaseUrl + "?code");
if (window.location.href.indexOf("?code") > 0 && code.length < 10) {
alert("Could not find auth code from query parameter");
}
if (code !== null && code !== "" && code !== undefined) {
this.router.navigate(['/loginParam', code]);
}
else {
this.router.navigate(['home']);
}
}
}