Questions tagged [angular-promise]

Angular's $q promises provide a powerful abstraction over flow control. If you tag your question with this tag, consider also tagging it with "promise" tag. This tag is also appropriate for questions about angular and promises not relaying to $q directly.

Angular's $q promises provide a powerful abstraction over flow control. If you tag your question with this tag consider also tagging it with the promise tag.

This tag is also appropriate for questions about angular and promises not relaying to $q directly.

2114 questions
0
votes
1 answer

How do I return a collection from $q.defer().promise in Angular?

Angular v.1.6.1 I am attempting to return a collection using $q.defer().promise, but I am only getting a single record instead of both records that are returned from my service. The Model: angular.module('app').factory('User', function() { /** …
Zoop
  • 872
  • 3
  • 11
  • 24
0
votes
2 answers

How to add promise call inside forEach loop

angular.forEach(data.rows, function(value, key){ var cell = []; subId = 0; angular.forEach(vm.tableJson, function(value1, key1){ if(value1.Type != 'table'){ if(key == 0){ …
noname
  • 45
  • 1
  • 1
  • 7
0
votes
1 answer

Angular use $http promise data in controller

I am trying to use an $http promise from a factory withing my controller. Code below works, and I can view the users variable in the view by calling {{users}} Working Factory: .factory('bidsCreatedSimple', ['$http', function($http) { // Expose…
GavinBelson
  • 2,514
  • 25
  • 36
0
votes
1 answer

Dynamic number of Promise in Angularfire2

I am bulding my project in Ionic2 using Firebase and Angularfire2. In a method I want to wait for multiple Promise to return. So I am using following approch. deleteAll(param: string[]) { return Promise.all([ this.storage.remove(param[0]), …
Tapas Mukherjee
  • 2,088
  • 1
  • 27
  • 66
0
votes
1 answer

Angular - unable to get a stream of data from $interval returned promise

I'm learning how to use angulars $interval by building a simple app that generates random string every second (inside a service) and returns it to the controller. However, I cant get the data. I am able to console.log it inside the function call,…
Alex
  • 1,982
  • 4
  • 37
  • 70
0
votes
2 answers

Method chaining and promises issue in Angular app with regards to returning a compared and updated array

I am trying to filter/match a list of returned IDs to a list of JSON data records, but I am struggling with (I believe) my promises and method chaining. I can get the functions to work, except for when I add step 3 below. Then it resolves without…
onmyway
  • 1,435
  • 3
  • 29
  • 53
0
votes
1 answer

Angular2 Promise .then is not defined

I am trying to build MEAN Application using Angular 2. Flow is like login.component.ts handing event calling getLogin function of auth.service.ts auth.service.ts making Promise to Express server on url /login. But unable to make proceed and getting…
0
votes
2 answers

Angular - [].concat.apply return empty array

I have this Ionic code: .factory('resultsFactory', function($http, $q, $rootScope, $firebaseArray, $timeout) { var results = {}; function _all(){ var d = $q.defer(); var palabras = $rootScope.textAreaOfrecer.toLowerCase().split('…
0
votes
1 answer

Consecutive writings to several files in the server

(* As my previous question has been more or less answered, and the code has evolved, I open a new question. *) I want to build a simple playground with MEAN stack that mimics plunker: we have a list of files and a textarea on the left hand, and a…
SoftTimur
  • 5,630
  • 38
  • 140
  • 292
0
votes
1 answer

Can I resolve a promise from a broadcasted event?

We're using angular legacy (1.5) I am trying to bulk load some layers using a 3rd party library. I need to wait till they are loaded before continuing. So in my get data section, it calls the library and asks it to add data, I start a $q.defer in…
0
votes
2 answers

Promise Angularjs 1.6 How can I force function to wait for api response

Im using this plugin: http://www.codingdrama.com/bootstrap-markdown/ I want to hook the onPreview So on onPreview i try to make my api call: app.directive("markdowntextarea",function ($http, $q) { // inject $q return { link: function…
62009030
  • 347
  • 1
  • 5
  • 20
0
votes
1 answer

Can't create a chaining promise with firebase and AngularJS, a FirebaseArray with two sequential calls to fetch data from two different tables linked

I have the two following tables with services and categories: - servicecat - catid - name : "Category Name" - services - srvid1 : true - srvid2 : true - srvid3 : true - services -…
0
votes
2 answers

$q.all not working as expected

It's like there is a loading div that I want to show if two API calls are yet not ready with the results. SO that the results all of sudden do not jump into the view causing it to flicker. My view looks something like this :
StrugglingCoder
  • 4,781
  • 16
  • 69
  • 103
0
votes
1 answer

Sort an array of objects after $q.all resolves

Coding an app with AngularJs. I want to retrieve a list of all groups a user has joined. I wrote the following: controller('DashCtrl', function($scope, $q, $localStorage, AuthService, DatabaseService, GroupService) { console.log("*** DashCtrl…
Manuel RODRIGUEZ
  • 2,131
  • 3
  • 25
  • 53
0
votes
1 answer

Use promises in nested maps with $q.all()

I am trying to figure out what data-structure of promises I can use in $q.all() function. I know that I can give it an array of promises and a map of promises, but can I give it an aribitrary depth map as well? eg can I do something like: var map =…
rex
  • 3,133
  • 6
  • 35
  • 62