javascript - XML file to AngularJS Charts App -
i have plunker here shows have far. i'm new angular , having trouble figuring out how exchange current static parameters chart data in xml file i'm uploading. have myapp.service
module getting xml file , converting json using x2js library, i'm not sure enter the function of controller. there aren't many helpful resources on web (i've been trying figure out day now). appreciated.
here: http://plnkr.co/edit/gdwrc1p40w4rhoehana1?p=preview
i didn't use xml, moved json object you're using demonstrate proper use of service , $http
module. you'll have model xml data useable json object yourself...
in service: return promise:
get: function() { return $http.get( 'data.json', { transformresponse: function(data) { return json.parse(data) } } ) }
and use in controller:
datasource.get().then(function(data) { //this xml data can used $scope.data = data.data $scope.items = ['selection 1', 'selection 2']; $scope.selection = $scope.items[0]; }, function() { console.log('error') });
Comments
Post a Comment