vitordelfino

Untitled

Apr 28th, 2017
509
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Component } from '@angular/core';
  2. import {Http } from '@angular/http';
  3. @Component({
  4.   selector: 'app-root',
  5.   templateUrl: './app.component.html',
  6.   styleUrls: ['./app.component.css']
  7. })
  8. export class AppComponent {
  9.   title = 'app works!';
  10.   //http://localhost:8080/WebServiceSPPD/sppd/getListaEstacao --> não funciona
  11.   //https:// -->ep.com.br/ws/06332240/json/ --> funciona
  12.   url: string = 'http://localhost:8080/WebServiceSPPD/sppd/getListaEstacao';
  13.   constructor(http: Http){
  14.  
  15.     http.get(this.url)
  16.       .map(res => res.json())
  17.       .subscribe(estacoes => {
  18.           console.log(estacoes)
  19.       });
  20.   }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment