Reputation: 141
I'm trying to build a blog using Angular.
I have a controller and its associated view. I also have an assets folder with a number of markdown pages. I'll have a directive in the view whose contents will be filled with a certain markdown file's contents.
What I would like to do is have a simple function in my controller which loads the contents of one of the markdown files into the controller, then that can populate the directive.
Where I am stuck is how do I load one file (I'm assuming I'll know its name and path), into my controller? Do I have to use something like Browserify so I can can use the 'fs' node module, or is there a simpler way to access the file system?
Upvotes: 1
Views: 252
Reputation: 1122
Files on the filesystem can not be accessed using JS, you would need to publish the markdown pages to a webserver, or make a service on your backend that returns the content of the file.
Either way, the markdown will need to present on the server.
Upvotes: 1