Search Posts

Category: angular-promise

How to wait/finish multiple insert function in for each loop?

how to do this asynchronously, print console.log(“PRINT THIS, AFTER ALL LOOP IS DONE”) i have forEach inside forEach. InsertService does not return any value, i just want to insert here. i don’t know how to apply $q and $q.all. pls help. angular.forEach(MAIN, function (value, key) { //#1 SelectService1.SelectID( (res) { angular.forEach(res, function (value, key) { InsertService1.Insert(value).then(function (res) { console.log(“NEW INSERTED Service 1!”); }, function (err) { }); }); }, function (err) { }); //#2 SelectService2.SelectID( […]

Update Angular JS1 UI when a row is updated in mysql with php on the backend

I want to update the User interface with HTML/AngularJS-1x and Php/mysql on the backend. The staging table is populated by another cpp process, I looking for ways to update the UI when that staging table is populated. I am fine with creating API or waiting using Angular Promises. But how do we proceed. One idea could be : create an get_items api which counts the staging table rows and return if the rows are there.On […]