My requirement is fetching data from gitlab file through Angular application . We don't have any back end service to provide data. I have to get data directly from gitlab file. So I wrote below code.
private _jsonURL = 'gitlabpath/appdata.json';
constructor(private _Activatedroute: ActivatedRoute, private http: HttpClient, private rd: Renderer2) {
this.getJSON().subscribe(data => {
this.objJs = data;
});}
public getJSON(): Observable<any> {
const headers = new HttpHeaders({})
return this.http.get(this._jsonURL, {headers});}
But I am getting the following error
*
has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
*
Please help me to fix this issue.
I didn't see any example for accessing gitlab file from angular code anywhare.