最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - AngularJS - How to list the filenames from a given folder? - Stack Overflow

programmeradmin0浏览0评论

I have this folder/directory 'x' in the public folder of my application. Now I have path name till the folder i.e., /path/to/dir/x , but I don't know the names of the files in this directory. Now I need to provide URL links to the files in the html a tag's href attribute.

How do I list the name of the files in this directory?

I have this folder/directory 'x' in the public folder of my application. Now I have path name till the folder i.e., /path/to/dir/x , but I don't know the names of the files in this directory. Now I need to provide URL links to the files in the html a tag's href attribute.

How do I list the name of the files in this directory?

Share Improve this question asked Apr 6, 2015 at 11:44 Harsha VardhanHarsha Vardhan 1011 gold badge1 silver badge9 bronze badges 4
  • 5 AngularJS is client side(runs in browser) you have to do this in server side and get the information using $http – seenukarthi Commented Apr 6, 2015 at 11:54
  • 1 Try this solution [Link][1] or [enter link description here][2] [1]: stackoverflow./questions/20822273/… [2]: stackoverflow./questions/15448574/… – Bhavesh Chauhan Commented Apr 6, 2015 at 11:57
  • 1 Use Directory.GetFiles(path) method to list all the files and then in angular use ng-repeat and build a URL on the client. – Nilesh Commented Apr 6, 2015 at 14:36
  • Alternatively, you can use AJAX calls: stackoverflow./a/11213851/2220216 – dshgna Commented Sep 7, 2015 at 16:59
Add a ment  | 

1 Answer 1

Reset to default 1

Angular is a client side library. Getting files from file directories is a backend capability.

发布评论

评论列表(0)

  1. 暂无评论