I am using node js for backend and angular for frontend. I have a scoped function inside of app.js that I would like to execute upon the html page loading. I can get the functionality I want if I add this logic behind a button, but ng-init is unsuccessful. By unsuccessful, I mean that it will do what I want only 10% of the time. How can I execute this function one time when the page loads and make sure that it persists?
This works
<button ng-click='setCurFiles("/Users/nick/Desktop/");'>test</button>
This works but is not reliable
<div ng-init='setCurFiles("/Users/nick/Desktop");'></div>