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 to mock AngularJS promises using Jasmine / Karma?

This is my controller: angular.module("AuthenticationApp", ["BaseApp"]) .controller("AuthCtrl", ["$http", "BaseService", function($http, BaseService) { var self = this; BaseService.fetch.stuffs() .then(function(data)…
SilentDev
  • 20,997
  • 28
  • 111
  • 214
0
votes
2 answers

Angular from service to component array

I'm struggling with Angular Services and can't find out what's the issue. I'm working on a book app (with Promises). For efficiency reasons, I'm refactoring my code with service injection. I use the service for all the http requests (there's a rest…
raik
  • 33
  • 2
  • 13
0
votes
2 answers

Using $q service to make a function return deferred.promise but it is returning undefined

I'm using Angular's $q service to return a promise. In my function the promise is resolved when I find the picture(a object) by a id(key value) which I'm searching in a array of pictures. I get the pictures if array is empty else I start…
y13uc162
  • 3
  • 1
0
votes
0 answers

Thinking of angular's $q.all using Java Concurrency

In Angular.js library, we have an api $q, $q.all() accepts promise array, i.e. $q.all([promise1,promise2,....,promiseN]).then(function); The callback function is resolved only after all the promises passed in arguments are resolved, As you can see…
Rahul Shivsharan
  • 2,481
  • 7
  • 40
  • 59
0
votes
1 answer

For Each loop with promises not working in angularjs

The "types" parameter being passed in is in the format ["hourAverage","hourMedian","dayAverage","dayMedian","weekAverage","weekMedian","monthAverage","monthMedian"] Source: $scope.buildCharts = function(types){ var deferred = $q.defer(); …
0
votes
1 answer

Issue in accessing $scope variable in $mdDialog Controller - AngularJs 1.X.X

I'm using $mdDialog and I specified a Controller which is present in another js file. Parent Js Controller: $scope.AddDesignationPrompt = function(ev) { $mdDialog.show({ controller: 'AddDesignationPromptController', templateUrl:…
user7784919
0
votes
2 answers

Await callback request api before start application angular

I need to load some parameters from Api end point before bootstrap application Angular 1. I have a factory that contains my functions for request end point and save in memory. I need to use this factory to execute my roles. The problem is that I can…
0
votes
1 answer

Angular2 call to web service via a promise is resolved before web service called is complete

I have an angular 2 service that has a function which returns data for a dropdown list. The function returns a promise. Code from service below: getStuff(): Promise { return…
LanceM
  • 1,888
  • 4
  • 23
  • 41
0
votes
3 answers

How to correctly override `errResponse` which is passed to the `catch(function(errResponse){` function?

This is my controller: angular.module("AuthenticationApp", ["BaseApp"]) .controller("MainCtrl", ["$http", "$window", "BaseService", function($http, $window, BaseService) { var self = this; self.add = function() { …
SilentDev
  • 20,997
  • 28
  • 111
  • 214
0
votes
1 answer

AngularJS Promise Resolved but cannot reach data

var promise = GetQuestions.quote.get(); console.log(promise); promise.$promise.then(function(quote) { $scope.quotes = quote; console.log($scope.quotes); for( quote in $scope.quotes){ console.log(quote.cite); …
0
votes
0 answers

Data binding and promise in AngularJS

I have the following factory I use to return a http promise with the user data from the server (function () { angular.module('BlurAdmin.theme') .factory('getData', function($http){ var service = {}; service.objData = null; …
Edgar Barber
  • 345
  • 3
  • 13
0
votes
1 answer

Sending a promise from one controller to another in Angular

In my web app, I would like to load all of the user data at the beginning, in the run method and pass the data to the other controllers to be shown to the user in the dashboard. So lets say I have a data structure on the server data = { x : 30, …
0
votes
0 answers

Wrap promise in function that only returns when promise has been completed

I want to create some code that executes sequentially as follows: console.log('Called before the function containing a promise'); var result = getSomeData(); console.log('Called after getSomeData() has completed fully'); getSomeData() { var stuff…
Bill Noble
  • 6,466
  • 19
  • 74
  • 133
0
votes
1 answer

Questions about async, promises, and chaining in AngularJS

I've been trying to study on my own the basics of promises, async calls and how to chain them in AngularJS. Currently I'm maintaining an app that likes to use them everywhere, and as a novice they're really overwhelming to say the least. First off,…
Dee J.
  • 365
  • 4
  • 21
0
votes
1 answer

Method x fat arrow in TypeScript

What is the difference between: export class Test { x: any; processData = (data) => { console.log("This=",this); this.x = data; console.log("Loaded.", data); } } and this: export class Test { x: any; processData(data) { …
Chocksmith
  • 1,188
  • 2
  • 12
  • 40