Passing function arguments to $scope.$apply? Passing function arguments to $scope.$apply? angularjs angularjs

Passing function arguments to $scope.$apply?


Wrap stripeCallback into an anonymous function:

var stripeCallback = function (status, response) {    ....};$scope.submit = function () {    $scope.errorMessage = 'Processing...';    $scope.buttonDisabled = true;    // can't use bindings for some reason    var myForm = $('#paymentform');    Stripe.createToken(myForm, function (status, response) {        $scope.$apply(function() {            stripeCallback(status, response);        });    });};


You can also just call $scope.$apply() after calling your callback:

Stripe.createToken(myForm, function (status, response) {    stripeCallback(status, response);    $scope.$apply();});