角2 http得不到我剛進入角形2,還在學習我嘗試用GET調(diào)用來點擊URL,但是GET似乎沒有經(jīng)過,即使在瀏覽器的網(wǎng)絡(luò)中,我也找不到被調(diào)用的GET URL。程序?qū)⑥D(zhuǎn)到該方法控制臺,記錄在GET調(diào)用上面和下面,但對于get調(diào)用沒有任何記錄。我的服務方法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");
}進口HttpModule在app.module.ts中我的控制臺屏幕截圖
添加回答
舉報
0/150
提交
取消