I have important question, please help me as soon as possible
when im testing laravel part by postman - api works well
unfortunetly on front i got problems with it. its like angular try to connect with api on 4200 port
no 8000
.
I have important question, please help me as soon as possible
when im testing laravel part by postman - api works well
unfortunetly on front i got problems with it. its like angular try to connect with api on 4200 port
no 8000
.
You create code like that...
import { Injectable, EventEmitter } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class FileService {
refressFileList: EventEmitter<string> = new EventEmitter();
constructor(
private http: HttpClient
) { }
getBooks(): Observable<Book[]> {
return this.http
.get<Book[]>('http://www.localhost:8000/api/books')
.pipe(catchError(this.handleError('getBooks', [])));
}
getData(params: any): Observable<any> {
return this.http.get<any>('http://www.localhost:8000/api/books', params);
}
}