ich ein Problem mit meinem Code bin vor mir, was los ist falsch an kann es nicht verstehen .. interessante Dinge sind, dass api recht gut ruft aber es ist nicht in success
Funktion geht orders.pay(ss($scope.ss, $scope.oo)) .success(function (data) {
Fehler Erfolg keine Funktion in AngularJS ist
angular.module('services.orders', ['users.service'])
.factory('orders', ['$http', 'user', '$q', function ($http, user, $q) {
'use strict';
function genericSuccess (res) {
return res.data.data; // yes, really.
}
function pay (payment) {
return $http.post('v1/payment/authorize', payment)
.then(genericSuccess);
}
orders.pay(ss($scope.ss, $scope.oo))
.success(function (data) {
//It should called success either it should gone to error but it says
//Error:orders.pay(...).success is not a function
//can any one suggest how to solve it
notify.message('Thank you!');
}).error(function (data) {
notify.message('Error: ' + data.data.message);
});
Wie sieht die 'orders'-Funktion aus? Posten Sie es, wenn Sie können. – mtndesign
'.success' und' .error' sind veraltet, auch wenn dies nicht die Ursache Ihres Problems ist, sollten Sie sie trotzdem vermeiden. Verwenden Sie stattdessen ".then" und ".catch". – ste2425