can anyone help me ti fix this issue error - typeerror cannot read property 'then' of undefined Angular js
I'm use to develop web application using angular js and asp.net mvc when i am inserting data to db ('typeerror cannot read property 'then' of undefined Angular js') this error raise and data customer data is not passing to the .net code. can anyone help regarding this . i m new to angular js
var app = angular.module('adminmdl', []);
app.controller('admincontroller', function ($scope, AdminService) {
$scope.Action = 'Add';
$scope.AddCustomerDetails = function () {
var customer = {
cus_code: $scope.Customercode,
cus_name: $scope.Customername
}
if($scope.Action =='Add'){
AdminService.AddCustomer(customer).then(function (customer) {
$scope.msg = "Customer Adding Successfully";
});
}
}
})
.factory('AdminService', function ($http) {
var fact = {};
fact.AddCustomer = function (customer) {
$http({
url:'/Admin/AddCutomer',
method:'POST',
type:JSON.stringify(customer),
dataType:'json'
});
}
return fact;
})
public void AddCutomer(Customer customer) {
if (customer != null) {
te.Customers.Add(customer);
te.SaveChanges();
}
}
return $http({....- Alon Eitan