首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Angular 2 http get未获取

Angular 2 http get未获取
EN

Stack Overflow用户
提问于 2016-12-29 21:59:47
回答 2查看 56K关注 0票数 58

我刚接触Angular 2,还在学习如何使用get调用来访问URL,但是get似乎不能通过浏览器的网络,我找不到被调用的get URL。

程序将转到方法控制台,记录get调用上下记录,但不记录get调用

我的服务方法

import { Headers, Http, Response } from '@angular/http';
import { Injectable } from '@angular/core';
import { Persons } from './mock-people';
import { Person } from './person';
import {Observable} from 'rxjs/Rx';

getAllPersons(): void {
  console.log("Here");
  this.http.get(`http://swapi.co/api/people/1`)
    .map((response: Response) => {
      console.log(response.json());
      response.json();
    });
  console.log("Comes here 2");
}

在app.module.ts中导入HttpModule

我的控制台屏幕截图

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41381200

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档