I'm new to Ember so please bare with me.
I want to convert my xml to json so I've installed xml2json bower component but I'm not sure how to import & use in my app.
My steps were
bower install xml2json
in ember-cli-build.js I put this line before return app.toTree()
app.import('bower_components/xml2json/xml2json.js');
in app.js I have this code
import xml2json from 'xml2json';
...
ready: function () {
Em.$.ajax({
url: "/data/sequence.xml",
dataType:"xml"
}).done(function(xmlData){
var jsonData = Em.$.xml2json(xmlData);
console.dir(jsonData);
console.log(JSON.stringify(jsonData));
});
}
I'm getting this console error:
Could not find module `xml2json` imported from `sequence-app/app`
I'm hoping it's something simple I've missed, can anyone outline what the process should be?
Aucun commentaire:
Enregistrer un commentaire