Sono di fronte a un problema con il mio codice non riesco a capire che cosa è che non va su di esso .. cose interessanti è che API sta chiamando abbastanza buona, ma non la sua intenzione in success
funzione orders.pay(ss($scope.ss, $scope.oo)) .success(function (data) {
successo errore non è una funzione in Angularjs
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);
});
Che aspetto ha la funzione 'orders'? Pubblicalo, se puoi. – mtndesign
'.success' e' .error' sono deprecati, anche se questa non è la causa del tuo problema, dovresti davvero evitare di usarli comunque. usa invece '.then' e' .catch'. – ste2425