2

I have an XML file which contains employees' data.

<Employee>
  <ID>01</ID>
  <FirstName>Steven</FirstName>
  <LastName>Smith</LastName>
  <Phone>123456789</Phone> 
</Employee>    

I want to display this data in a web page using AngularJS.

From Google search I found I need to prepare a JavaScript function to read data from XML, create this JS function as ng-app, and then call this app in HTML web page to display data.

I don't know how to do this.

Nathan Tuggy
  • 2,237
  • 27
  • 30
  • 38
ARB
  • 285
  • 1
  • 6
  • 17

2 Answers2

0

How to handle XML services in AngularJS?

From that Q&A, https://code.google.com/p/jquery-xml2json-plugin might be just what you're looking for.

Community
  • 1
  • 1
Matt Welch
  • 670
  • 4
  • 11
0

You need to convert XML to JSON before you can use it with AngularJS. Try this library: https://github.com/abdmob/x2js And explanations are great in this post: http://rabidgadfly.com/2013/02/angular-and-xml-no-problem/

dubucha
  • 1,027
  • 10
  • 16
  • Please add some more information, nut just a link on another side. It is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes – slfan Apr 28 '16 at 18:21