Guest User

Untitled

a guest
Feb 22nd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. @Injectable()
  2. export class RestaurantesProvider {
  3. private url: string = "http://199.169.9.9/ws/ListarEstados.ashx";
  4. constructor(private http: Http) {
  5. console.log(this.url);
  6. }
  7.  
  8. getRestaurantes(){
  9. return this.http.post(this.url, null)
  10. .do(this.logResponde)
  11. .map(this.extractData)
  12. .catch(this.catchError);
  13. }
  14.  
  15. private catchError(error: Response | any){
  16. console.log(error);
  17. return Observable.throw(error.json().error || "Erro de conexção");
  18. }
  19.  
  20. private logResponde(res: Response){
  21. console.log(res);
  22. }
  23.  
  24. private extractData(res: Response){
  25. return res.json();
  26. }
  27. }
  28.  
  29. private url: string = padrao + "ListarEstados.ashx";
  30.  
  31. export class AppModule {
  32. private url: string = "http://199.169.0.9/ws/ListarEstados.ashx";
  33.  
  34. getUrl(){
  35. return this.url;
  36. }
  37. }
  38.  
  39. private url: string = AppModule.getUrl();
  40.  
  41. export class AppModule {
  42. private static url: string = "http://199.169.0.9/ws/ListarEstados.ashx";
  43.  
  44. static getUrl(){
  45. return this.url;
  46. }
  47. }
  48.  
  49. private url: string = AppModule.getUrl();
  50.  
  51. import { AppModule } from '../app/app.module';
Add Comment
Please, Sign In to add comment