角2 http得不到我剛進入角形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");
}進口HttpModule在app.module.ts中我的控制臺屏幕截圖
添加回答
舉報
0/150
提交
取消