Hi, I have an issue where the view is empty until I for example click the menu icon. When I click it, the content gets rendered. It doesn’t always happen. There are no errors. How can I debug this?
The only new here is that all API calls are made with:
why do you are wrapping everything in a new Promise()?
you api call already a promise?
And you should use then $q from angularJS and please use never $scope.$apply if you do not know, what you can destroy with that. Wrap your scope-changes in $timeout…
But in your case… you do not need any $timeout or $apply.
The API service itself is promise based, correct. Also with new Promise(). Looks cleaner I thought.
Then I have wrapped the API calls in the controller within a new Promise. Reason for that is that I reuse parts of the controller code in a refresAction() function that also needs a then() to do stuff after refresh of page.
So maybe the mix of Javascripts own Promise function with the AngularJS $q version is not a good mix…
I switched out all of my new Promise(function(resolve, reject) to $q(function(resolve, reject)) and removed $scope.$apply() and it all seem to work now as expected. Greatness. Thx.