Answer the question
In order to leave comments, you need to log in
How to rewrite jquery code in angular2?
Hello.
I need to rewrite the request code from jquery to angular2.
There is a code:
$.get("https://ipinfo.io", function(response) {
console.log(response.ip, response.country);
}, "jsonp")
public getLocationUser() {
let headers = new Headers({ 'Content-Type': 'application/json'}); //../jsonp
let options = new RequerstOptions({ headers: headers })
return this.http.get("https://ipinfo.io", options).map(location => location.json())
.subscribe((loc) => loc)
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question