Search Posts

Category: callback

AngularJS restangular post callback

I am using restangular with AngularJS, and I need to use some function, which will trigger callback function/promise after POST response. I tryed setResponseInterceptor which did not helped in this situation. I need to use this function to lock form from submission until response will come back to client, and then unlock it to future use. Do you know some magic for this? I am using this code, and want to fire custom function when […]

scope variable can not be setted inside service callback

I have the following code: svcUploadMidia.load(scope.TableId, scope.TableName, function(res) { scope.Midias = res.data; for(var i = 0; i < scope.Midias.length; i++) { scope.Midias[i].conteudoBase64 = “data:image/png;base64,” + scope.Midias[i].conteudoBase64; } }, function(err) { errorHandler(err); }); This code is inside a directive and is called by another directive. But all changes made inside the svcUploadMidia.load callback is not setted in the directive scope.Midias and the ng-repeat in the html still empty. Someone know how can I fix it? Source: AngularJS

Call back function returns an object which cannot be accessed ,it only appears in console.log in angular

I have followed the below git hub link that has a service called myapp.services and using this service in login function as (googleService) function login () { googleService.login().then(function (data) { $http.post(‘/googleSignIn’,data) .then(function (data) { // window.location.reload(); }, function (err) { if (err.data.message) { toastr.error(err.data.message); return; } }); }, function (err) { console.log(‘Failed: ‘ + err); }); }; The data object can be seen in console.log statment only when I click the arrow beside it and […]

How to use the callback on the basis of selection in Angular js?

I am trying to design a simple game application. There is a list of games available and there is a list of selected game. My intention is to show whatever the games is not selected in the modal and ask user whether they want to add it or not. Once they skim all the available games we can get the final selection of whatever the games selected and not selected.I am Stuck at one point, […]

Nodejs callback response not working as expected

I’m trying to authenticate a user based on values entered in a given form. However, after using res.send(), the function at AngularJS controller is not able to correctly redirect user even if the password and username are correct. Am I handling the callbacks correctly? Controller <script> var app = angular.module(‘myApp’, []); app.controller(“loginController”, function($scope,$http) { $scope.sub = function() { var config = { headers : { ‘Content-Type’: ‘application/x-www-form- urlencoded;charset=utf-8;’ } } $http.post(‘/login’, { data:{ username: $scope.username, […]