angularjs - Angular Js : undefined value in pop up -
i problem in angularjs when getting data json using service factory ($resource)
services.factory('getcustomerbyemailfactory', function ($resource) { return $resource(url + '/customerservice/getcustomerbymail?email=:email', {}, { getbymail: { method: 'get', params: {email: '@email'} } }); });
this service works
but controller part doesn't work
app.controller('customercreationctrl', ['$scope','postcustomerfactory', '$location','subscription','addnotificationfactory','$routeparams','getcustomerbyemailfactory', function ($scope, postcustomerfactory, $location,subscription,addnotificationfactory,$routeparams,getcustomerbyemailfactory) { $scope.customer ={}; $scope.not ={}; $scope.aftercustomer ={}; $scope.createnewcustomer = function(){ number($scope.customer.phonenumber); $scope.customer.subscriptiondate = "1990-02-23t00:00:00"; $scope.customer.manageridcustomer=1; postcustomerfactory.create($scope.customer); var customer = getcustomerbyemailfactory.getbymail({email:$scope.customer.email}).$promise; customer.then(function (responce){ $scope.aftercustomer = responce; window.alert($scope.aftercustomer.id); $scope.not.customerid = $scope.aftercustomer.id; $scope.not.managerid = $routeparams.id; addnotificationfactory.create($scope.not); }); $location.path("/login"); }; }]);
the window.alert show me undefined value doesn't data
Comments
Post a Comment