Questions tagged [angularjs-q]

14 questions
5
votes
3 answers

Is there an any method ordering when $q.all has multiple http call functions in Angularjs?

First of all, I am not good at angularjs. While I've been studying about $q, I faced a weird problem. When I use $q.all, I put $http in regular sequence expecting to get results in same order, but what I get was random results. See this and correct…
Canet Robern
  • 1,049
  • 2
  • 11
  • 28
4
votes
2 answers

Possibly unhandled rejection -- Error when creating a form with angularjs

I created this simple web application to put data into a firebase database. The problem is that I get a error when I open the webpage in my browser. This is the error I get Possibly unhandled rejection: {} angular.js:14324 Also when I press the…
Luukth
  • 73
  • 2
  • 9
2
votes
2 answers

Collating all the http response inside a common function using $q in Angularjs

I am trying to use the $q service inside my controller. I have multiple environment which I need to hit and collect the data and consolidate the data and then put inside the scope. I have the below code. var results=[]; for(var environment…
zilcuanu
  • 3,451
  • 8
  • 52
  • 105
1
vote
2 answers

I can't create filter to extract all elements that i need

I get prices, even that I don't need, how can I filter them?
$
Max Volobuev
  • 79
  • 2
  • 11
1
vote
0 answers

Angularjs Chaining Promises and $q

while executing the code alert("promiseC done") is displaying first and then alert("promiseC"); is displaying last because of this the data was not displaying properly from function Displaydata(); from belo code. App.controller("Ctrl", function…
1
vote
2 answers

Difference between Sequential and Parallel executing in $q

In both of at the time of execution of an asynchronic operation only. But how the $q handle for this is a Sequential call or Parallel call on runtime? and let me brief explanation about the Difference between Sequential and Parallel executing…
Ramesh Rajendran
  • 37,412
  • 45
  • 153
  • 234
1
vote
1 answer

mapping the response to corresponding request

I am making $http request to multiple environment and processing after I get all the responses. I am using the code below: $q.all(Object.keys($rootScope.envs).map(request)).then(function(res){ var results = {}; for (var env in res) { …
zilcuanu
  • 3,451
  • 8
  • 52
  • 105
0
votes
1 answer

getting Error: [$rootScope:inprog] $digest already in progress when changed from Fetch to $http + $q

I'm trying to do a http request inside Angular.js factory. Initially I had used Fetch API and the console didn't show any error. I implemented it using $http along with $q and now it shows errors on my console even though the functionality seems to…
cmgchess
  • 7,996
  • 37
  • 44
  • 62
0
votes
1 answer

AngularJs $q.all is not working with for loop

I've below code and want to execute the function DisplayData() after the for loop completes only but the DisplayData() is executing along with for loop so the data is displaying after each iteration of the for loop item which is not excepted. var…
0
votes
1 answer

How can I use Promise/$q.all

I'm trying capture HTML content dynamically based on different conditions as below. function insertHtmlContent(dates, Plant_Id) { var dayhtmlContent1 = ''; var dayhtmlContent2 = ''; var deferred = $q.defer(); var urlCalls =…
0
votes
3 answers

unable to use $q and promise

I want to use the variable StatusASof to display data in the inserthtml function as below. App.controller("SS_Ctrl", function ($scope, $http, $location, $window, $sce, $q) { var ShiftDetails = []; function getMAStatusASof(Id) { var…
0
votes
1 answer

AngularJs Jasmine Unit test fails with Unexpected Request

Following is my myService.spec.js : 'use strict'; describe('myService', function () { var dependentService,dependentService1,rootScope,$q; beforeEach(module('myModule.myConfig')); beforeEach(module('myModule')); …
0
votes
2 answers

$q.all in angular-ui modal controller resolving early after consecutive open/closes

I currently have a modal (Angular-UI Modal) that, when opened for the first time, works perfectly. However, after I close it and then re-open it, things start acting a little strange. The code: (function () { 'use strict'; …
Ben Black
  • 3,751
  • 2
  • 25
  • 43
-1
votes
1 answer

AngularJS promises, how to $q.first.then(others[])

In an AngularJs controller I need to ensure a paramount variable initialized before performing other tasks. var firstPromise = $scope.watch("myParamount"...); // from ng-init var otherPromises = []; // once obtained myParamount, do others //…
serge
  • 13,940
  • 35
  • 121
  • 205