6

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?

Harsha Vardhan
  • 101
  • 1
  • 1
  • 8
  • 5
    AngularJS is client side(runs in browser) you have to do this in server side and get the information using `$http` – seenukarthi Apr 06 '15 at 11:54
  • 1
    Try this solution [Link][1] or [enter link description here][2] [1]: http://stackoverflow.com/questions/20822273/best-way-to-get-folder-and-file-list-in-javascript [2]: http://stackoverflow.com/questions/15448574/jquery-fileupload-get-list-of-uploaded-files – Bhavesh Chauhan Apr 06 '15 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 Apr 06 '15 at 14:36
  • Alternatively, you can use AJAX calls: http://stackoverflow.com/a/11213851/2220216 – dshgna Sep 07 '15 at 16:59

1 Answers1

1

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

Mente Gee
  • 51
  • 1
  • 8
  • 2
    Welcome to StackOverflow! Thanks for this answer, but that's already been said in the first comment, so this doesn't add anything. – GKFX Apr 26 '16 at 19:45
  • 3
    Wrong! We have now 2017. We are using angular in electron that is running locally on desktop. So using the file system is a valid question. – Sandor Rozsa Oct 12 '17 at 08:51
  • @SandorRozsa So is it possible? – palimboa Nov 19 '18 at 15:12