All Questions
21 questions
2
votes
1
answer
496
views
Is returning promise form angular service bad?
What is the problem when I return a promise from angular service instead of Observable?
If it's a matter of any manipulation or side-effect, that I can easily do ...
2
votes
1
answer
4k
views
Script to load controllers dynamically for AngularJS
I would like to hear your thoughts, idea's or feedback on the following code.
Ive added to code to github.
https://github.com/redbullzuiper/angularjs-dynamic-controllers
Usually when you attach a ...
1
vote
1
answer
83
views
Chaining three promises in Angular.JS
I have demonstrated promise chaining where promise's p1,p2,p3 has to be resolved synchronously.
The code below is using angular.js 1, and here P3 is resolved then P2 and then P1.
...
3
votes
0
answers
295
views
AngularJs: Preventing multiple $q.get() per url
I've wrote a pretty useful method to prevent multiple requests per single get url. There is a well known pattern - to store promise and return it for each next ...
4
votes
1
answer
3k
views
AngularJS recursive function call with $timeout
I have created a recursive function call in AngularJS and just wonder if is there a better way to solve this problem? The code works perfectly.
My code is the following:
...
1
vote
1
answer
76
views
Angular Promise trying Wrapper
Sometimes I need to repeat an execution of rejected promises several times, for example, to fetch some data over internet.
There is a wrapper, which accepts Promise and tryCount:
...
10
votes
1
answer
235
views
Baseball player statistics controller
I'm somewhat new to JavaScript and AngularJS, and read in Doug Crockford's book that hoisted function declarations can lead to issues. If you have any pointers on how to structure my file, those would ...
1
vote
1
answer
107
views
Reservation booking code samples
I am putting together a couple code samples for prospective employers and would love some feedback. I am still pretty junior so I am not sure what constitutes a good code sample and the do's and dont'...
4
votes
1
answer
149
views
Conditional async validation function
We have the following validation function:
...
2
votes
3
answers
184
views
Save handler without a nested "deferred antipattern"
I have an application in which a user makes a change, and when they click Save they will be prompted to confirm, and the appropriate REST call will be made if they agree. The intial call to ...
6
votes
1
answer
3k
views
Asynchronous iterator for AngularJS
I wrote this as a convenient way to batch together multiple, repetitive AJAX calls. I was working in angular at the time, so I use the $q service, but I'm sure it ...
2
votes
1
answer
2k
views
Resolving promises on resolver using ui-router
We're rewriting some parts of our application. We're trying to avoid the promise anti-pattern and do things properly, but I'm not certain that we did so.
More precisely, we are rewriting the resolver ...
2
votes
1
answer
4k
views
Angular Broadcast Asynchronous Events
Okay I have the following use case:
Module A broadcasts an event.
Module B listens to that event.
Maybe also ...
3
votes
1
answer
130
views
Flow of Angular Promises
I recently put in a submission for a small coding challenge using Angular. The challenge was to get a token and array of values using a GET request then make another GET request passing the token and ...
1
vote
1
answer
136
views
Logging out using nested promises
Is it OK to do that ?
for example, I have my log out service
...