hey guys.
I want to using angular2’s http. and I make sample code for checking return value.
getData(suburl){
let url = '115.68.xxx.xxx' + suburl;
return this.http.get(url).toPromise()
.then(response => response.json())
.catch(this.handleError);
}
these are my code for http get, (I do not really know it works)
and i use url with suburl for my hosting server (i can check server with browser and it works correctly)
but it shows like this (when i user ionic run browser)
now i want adjust my question.
- can i delete localhost from url? like http://115.68.xxx.xxx
- these http.get code is right? how can i use?
- additionally, what ‘.then’ works? in other example some people use ‘.map’, I just thought it makes json but didn’t understand.
- additionally, .catch like JAVA code’s try, catch??
thanks for reading long question.