Вопрос

I'm attempting to retrieve xml for a timer that I want to parse into a view via AngularJS.

AngularJS, does not handle XML, very well if at all.
( More on that: How to handle XML services in AngularJS?).

I'm creating a factory and then using the x2js XML to JSON JavaScript plugin https://code.google.com/p/x2js/.

Everything is all good until line 31 of module.js

return json.TimerStatus;

The code won't return, because it's unreachable and I'm not sure why. I feel like there is a mismatch of the XML in some way but I'm not sure.

Could anyone please share their thoughts why the code on line: 31 of module.js is unreachable? I'm open to suggestions to solutions other than what I'm attempting.

Plunker Link
http://plnkr.co/edit/xOYj0JXrshnHBb8pYv6n?p=preview

Это было полезно?

Решение

The return statement in xmlTransform correctly returned the parsed object and then set data object in the callback function setData you passed in. Not sure how I fixed it but I just corrected some syntax errors. Hope it helps. (You can then assign it to the proper object to the template to show it on the page.)

Demo

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top