Search code examples
javascriptangularjsmodx

Angular - how to read file names in a directory


I'm using Angular JS in a ModX app, and I need to read the file names in a gallery (ModX's Gallery pacakge) every time the gallery is updated. Is there a way to do this in Angular?

I tried researching Javascript solutions to this problem, but all I saw were solutions using ActiveX, and this needs to be cross-browser compatible.

Thanks


Solution

  • @Strawberry is correct, this is a backend function. What you'll want to do is to set up a service on your backend that returns either json (simpler) or xml and then use either angular's $http or $resource service to make a call to that backend service. Review the $http doc on angular site for more details.