Click here to Skip to main content
15,891,204 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: I am not sure why this controller is not firing in this AngularJS script, any help Pin
indian14322-May-16 0:49
indian14322-May-16 0:49 
GeneralRe: I am not sure why this controller is not firing in this AngularJS script, any help Pin
indian14322-May-16 0:46
indian14322-May-16 0:46 
GeneralRe: I am not sure why this controller is not firing in this AngularJS script, any help Pin
Karthik_Mahalingam22-May-16 0:51
professionalKarthik_Mahalingam22-May-16 0:51 
GeneralRe: I am not sure why this controller is not firing in this AngularJS script, any help Pin
indian14322-May-16 1:13
indian14322-May-16 1:13 
GeneralRe: I am not sure why this controller is not firing in this AngularJS script, any help Pin
Karthik_Mahalingam22-May-16 1:16
professionalKarthik_Mahalingam22-May-16 1:16 
QuestionUsing JQuery $.when, addng a promise to each function so When knows its done. Pin
jkirkerx5-May-16 12:12
professionaljkirkerx5-May-16 12:12 
AnswerI think I might have it now, not sure if its the right way to do it, but it works. Pin
jkirkerx5-May-16 13:38
professionaljkirkerx5-May-16 13:38 
GeneralRe: I think I might have it now, not sure if its the right way to do it, but it works. Pin
Nathan Minier6-May-16 1:50
professionalNathan Minier6-May-16 1:50 
I don't think that I would chain the promises quite like that, since it'll be hard to do anything with it down the road and it forces asynchronous operations into a synchronous format.

I'd personally use a tracking object as a pre-load sentinel for your primary business object, pass an update/check callback to the resolution of each async call, and send them all off at once. This also gives the capability of seeing which particular calls might fail, rather than have the whole bundle collapse in on itself if there's an issue.

An example might look like:
JavaScript
var loadTracker = {
   track1: false;
   track2: false;
   track3: false;
   track4: false;
}

function doSomething(promiseItemName)
{
   loadTracker[promiseItemName] = true;
   if(loadTracker.track1 && loadTracker.track2 && loadTracker.track3 && loadTracker.track4){
      doThePromiseDependentThing();
   }
}

track1Promise.done(function(){ 
   //Update something
   doSomething('track1');
});

// And so on...
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli

GeneralRe: I think I might have it now, not sure if its the right way to do it, but it works. Pin
jkirkerx6-May-16 5:27
professionaljkirkerx6-May-16 5:27 
GeneralRe: I think I might have it now, not sure if its the right way to do it, but it works. Pin
Nathan Minier6-May-16 6:14
professionalNathan Minier6-May-16 6:14 
GeneralRe: I think I might have it now, not sure if its the right way to do it, but it works. Pin
jkirkerx6-May-16 7:28
professionaljkirkerx6-May-16 7:28 
QuestionNeed an API similar to YouTube Help popup window Pin
Zaki Gaima5-May-16 3:28
Zaki Gaima5-May-16 3:28 
Questionbrowser error handling using javascript Pin
rorschach2174-May-16 19:25
rorschach2174-May-16 19:25 
SuggestionRe: browser error handling using javascript Pin
Richard MacCutchan4-May-16 20:58
mveRichard MacCutchan4-May-16 20:58 
AnswerRe: browser error handling using javascript Pin
John C Rayan13-May-16 1:18
professionalJohn C Rayan13-May-16 1:18 
QuestionAsynchronouse Call Pin
Syed Rehman27-Apr-16 9:14
Syed Rehman27-Apr-16 9:14 
QuestionRe: Asynchronouse Call Pin
ZurdoDev27-Apr-16 9:29
professionalZurdoDev27-Apr-16 9:29 
AnswerRe: Asynchronouse Call Pin
John C Rayan4-May-16 22:20
professionalJohn C Rayan4-May-16 22:20 
Questionhelp me writing a small program Pin
Member 1248677626-Apr-16 10:36
Member 1248677626-Apr-16 10:36 
AnswerRe: help me writing a small program Pin
Afzaal Ahmad Zeeshan26-Apr-16 11:00
professionalAfzaal Ahmad Zeeshan26-Apr-16 11:00 
AnswerRe: help me writing a small program Pin
Peter_in_278026-Apr-16 21:05
professionalPeter_in_278026-Apr-16 21:05 
GeneralRe: help me writing a small program Pin
Karthik_Mahalingam5-May-16 23:27
professionalKarthik_Mahalingam5-May-16 23:27 
QuestionHelp me to write a small program. Pin
Member 1248677626-Apr-16 10:21
Member 1248677626-Apr-16 10:21 
AnswerRe: Help me to write a small program. Pin
Member 1161095626-Apr-16 10:53
Member 1161095626-Apr-16 10:53 
AnswerRe: Help me to write a small program. Pin
Afzaal Ahmad Zeeshan26-Apr-16 11:09
professionalAfzaal Ahmad Zeeshan26-Apr-16 11:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.