Questions tagged as 'promises'

0
answers

How to process a JSON in the event of a request-promise failure?

I have 2 microservices, one in NodeJS and one in Spring. The NodeJS contains the event domain (parties, birthdays, etc.) and the Java user domain. When querying the NodeJS event endpoints, I also query the user endpoints and add the equivalen...
asked by 28.10.2017 / 20:36
1
answer

Using Promises and Deffered in daily life

I'm studying about these items and I'm not sure how to apply them in my projects. I currently use callback for everything but the code structure gets tense .. and on the internet I found a lot of articles talking about the Promises and Deffered...
asked by 12.07.2016 / 14:51
2
answers

Check if URL exists

I would like to know how do I validate (if there are) a member's URL's, I am using AngularJS , AJAX and http requests however I can get the status of a URL that I created in a mock, but I can not check a URL if it is external...
asked by 17.04.2016 / 16:08
1
answer

Using Q promise to receive different apis values

I need to receive some APIS values. For example: calls to api1() and api2() return deferred.promise ; I can: api1().then( function(res1){ api2().then( function(res2){ console.log(res1, res2); }) }); How can...
asked by 29.06.2016 / 22:29
2
answers

Promises on NodeJS

I'm learning Node and getting a bit of asynchronous programming. To learn, I got the following example console.log("1"); setTimeout(function(){console.log("2");},3000); console.log("3"); setTimeout(function(){console.log("4");},1000);...
asked by 29.03.2018 / 05:09
1
answer

Call class method within a promise returns: Uncaught (in promise) TypeError: _this3.updateShelvesState is not a function

Good afternoon! I created a method called updateShelvesState which is called before the component is rendered, and the onChange of another component called Book . This method takes an array and creates a new array organ...
asked by 08.11.2017 / 19:39
1
answer

Evaluating the $ http response from the factory to the controller in AngularJS

I've created a Factory to perform the operations CRUD in a api REST using $ http service to make a user control. Factory //Listar..Recuperar ..Inserir ...Editar..{...} usuarioService.Excluir = function (id) { var promise =...
asked by 23.08.2017 / 15:16
1
answer

Update sweetalert 1.x for sweetalert 2 + javascript promises

When updating the library SweetAlert it stopped working, debugging the error saw that it had many modifications that made version 1.x incompatible with the new version, so I would like help transcribing my deletarRegistro() function....
asked by 13.02.2018 / 18:04
2
answers

How to update the collection of a service by index calling a second service?

In calling a service within my controller I load a few data, and as soon as this data is loaded, on the screen, the complete data for a given filtered item must come in, requests are occurring, the second one little slower, exactly as it should...
asked by 09.10.2017 / 22:08
0
answers

Return a variable (Singleton) using Node that depends on Promise

Good afternoon guys, How can I create a variable in NodeJS / JS where I would return a value only to be used multiple times throughout the program? Exemplifying my problem: I have to log in to a platform and then send data to it. When I l...
asked by 12.07.2017 / 21:05