@saifuddin_m wrote:
I am looking for solution to read and convert XML RSS Feed using ionic
[ERROR]
Access to XMLHttpRequest at ‘https://rss.com/feed/’ from origin ‘http://localhost:8100’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.ionic (Ionic CLI) : 4.9.0 (C:\Users\msaifuddin\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 4.6.0
@angular-devkit/build-angular : 0.13.9
@angular-devkit/schematics : 7.3.9
@angular/cli : 7.3.9
@ionic/angular-toolkit : 1.5.1stem:
NodeJS : v8.11.3 (C:\Program Files\nodejs\node.exe)
npm : 6.8.0
OS : Windows 10
╭─────────────────────────────────────╮
│ Update available 4.9.0 → 5.2.3 │
│ Run npm i -g ionic to update │
╰─────────────────────────────────────╯import { Injectable } from '@angular/core'; import { Http, RequestOptions } from '@angular/http'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/do'; import { Observable } from 'rxjs/Rx'; // let Parser = require('rss-parser'); @Injectable({ providedIn: 'root' }) export class RssService { private url: string = "https://rss.com/feed/"; posts: any; options: any; headers: any; constructor(private http: Http) { this.headers = new Headers( { 'Content-Type': 'application/rss+xml', 'Accept': 'application/rss+xml', }); this.options = new RequestOptions({ headers: this.headers }); this.http.get(this.url, this.options).map(res => res).subscribe( data => { this.posts = data; }, err => { console.log("Oops!"); }); } }Any help appreciated in
Posts: 1
Participants: 1