I want to implement a dynamic loading of a static resource in AngularJS using Promises. The problem: I have couple components on page which might (or not, depends which are displayed, thus dynamic) need to get a static resource from the server. Onc...
I have a ui-router StateProvider and need to pick between controllers & views based on external data, so I used TemplateProvider and ControllerProvider.  If I only had the TemplateProvider it all works fine, but when I add the ControllerProvider...
What's the equivalent of Angular's $q in Angular2?  Specifically, I'm looking for $q.when, which allowed you to do something like:  return $q.when(['TestResponse']);...
Angular 1.5.8 implements a $q.race() method which takes an array of promises and returns a promise which is resolves with the value of the first resolved promise.  However i am stuck with angular 1.4 for now and need some kind of functionality like a...
I am fairly new to using promises, I mostly stick to straight up callbacks. The following code happens to be found in an Angular Service, but that doesn't really matter that much, it's mostly regards how to create a promise that will promise...
Imagine I have a promise chain like the one below. If func2 is called, I would like to avoid func3 or func4 from being called altogether.   AsyncFunction() .then(func1, func2) .then(func3, func4)   At the moment, If I throw an error in func2, func4 w...
My application has a number of synchronous and asynchronous (doing a $http call) methods. In  the controllers I have code like this:  $q.all([     asyncMethod1(),     syncMethod1() ]) .then(function (results) {   Even though I have no need to wait on...
struggling to get promises working correctly in angularjs service provider i've read the docs as well as numerous examples (here, here and here) and i think i've got my syntax ok (although obviously something is wrong)  app module and control...
Let's say you have:  function myPromise() {   // using some promise lib other than $q, like Q or bluebird   var defer = Q.defer();   defer.resolve('John');   return defer.promise; }   and then you have something like:  function foo() {...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.