parsing directory listing of a webpage in angularjs

时间:2015-06-26 09:59:47

标签: javascript html parsing

I need to parse the directory listing of an external webpage in AngularJS. I found a few solutions to this problem, but those are in PHP. Is there anyway I can do it in angularjs?

I am making a $http.get call to get the html. I want to parse the html and convert into a json or xml. The structure of the html is as shown below

<head>
</head>

<body>
    <table>
        <tbody>
           <tr>
               <th> <img src = "abc.jpg"></th>
               ....
           </tr>
        </tbody>
    <table> 
</body>

1 个答案:

答案 0 :(得分:1)

$http.get将为您提供远程页面的HTML内容。解析它与Angular无关。有关解决方案,请参阅this answer,因为HTML是XML的一种形式。

一旦构建了JSON结构,Angular就可以很好地显示它。