First I wonder the URL is wrong, but turn out it is right. here is github api as my test url
I put it in chrome, it return desire result.
Second I wonder if my code is wrong
constructor(private fb: FormBuilder, private _userService: UserService, private _http:Http) {
this._http
.get('https://api.github.com/search/repositories?q=ng2&page=1&per_page=10')
.map((res: Response) => res.json())
.catch((res: Response) => {
return Observable.of({items: [], totalCount: 0, error: res.json()});
})
.subscribe(d => {
console.log(d);
})
}
this code always get this error message:
404 - Not Found Collection 'repositories' not found
But this URL can be accessed in my chrome.
and I can't find any wrong with my code.
I finally found why this happened.
Cause I add InMemoryWebApiModule into my module.
but I don't know what is root cause here
somebody could tell me?