IONIC 4 does NOT work for me (IONIC 3 working) What have changed?’
I am trying to parse a XML file from my assets/xml/myfile.xml files…
I am using
XML2Js
@angular/common/http
I used it in Ionic 3 with no problems but i migrating to Ionic v4. And fix one problem after onther.
But getting 404 error…
My XML File is located in this folder. And i can not get the data getting Error 404.
curlink_gv = '/assets/XML/myxmlfile.xml';
In Ionic 3 it works with the plugin
First i import my plugins in Home.page.ts
import { HttpClient } from '@angular/common/http';
import { HttpHeaders } from '@angular/common/http';
Then i trying to parse my file that is located in /assets/XML/myfile.xml
First i thought it was a path problem but tested every path i can use. even moved the file to the root of Home (togheter with home.page.ts files).
But not luck, searching for answers but can not find.
I getting error 404 error
loadXML()
{
this.http.get('/assets/XML/myfile.xml',
{
headers: new HttpHeaders()
.set('Content-Type', 'text/xml')
.append('Access-Control-Allow-Methods', 'GET')
.append('Access-Control-Allow-Origin', '*')
.append('Access-Control-Allow-Headers', "Access-Control-Allow-Headers, Access-Control-Allow-Origin, Access-Control-Request-Method"),
responseType:'text'
})
.subscribe((data)=>
{
this.parseXML(data, curYear_gv, curMonth_gv, curDay_gv)
.then((data)=>
{
this.xmlItems = data;
});
});
}
I hope i got an answer for this soon, because everything is holding my project to continue, If there is a better way to do this tell me also.
But i find this a very easy to change update files.
If you answer my question Please write a long answer so i understan not a professional on this area, New at ionic 4.
Best regards