I am developing an eCommerce website asp.net mvc with angularjs. I am getting some issue with $scope in one of my page.I define an $scope.items array in my controller and trying to fetch values in this array from cookies. here is the code
app.controller('checkoutController', ['$scope', 'productService', '$cookies', '$cookieStore', '$location', 'sharedService', '$rootScope', 'customerService', function ($scope, productService, $cookies, $cookieStore, $location, sharedService, $rootScope, customerService) {
$scope.items = [];
$scope.customer = {};
$scope.customer.FirstName = "";
$scope.customer.LastName = "";
$scope.customer.Email = "";
$scope.customer.Password = "";
$scope.customer.CPassword = "";
$scope.customer.Address1 = "";
$scope.customer.Address2 = "";
$scope.customer.ZipCode = "";
$scope.customer.Country = "";
$scope.customer.State = "";
$scope.customer.City = "";
$scope.customer.MobileNo = "";
$scope.logDetails = {};
$scope.logDetails.LogEmail = "";
$scope.logDetails.LogPassword = "";
$scope.customer.Roleid = 1;
$scope.items = $cookies.StyleStoreCart;
}
it gives me error that $scope.items is not defined. but its already defined
Experts please tell me where i m going wrong?
here is the url of live website. Please try to checkout and see error in console on checkout page.
http://stylesstore.com/Home/Products
here is the way I am inserting data to cookies in my application in my product page
var item = new cartItem(Picture1, ProductName, UnitPrice);
$scope.items.push(item);
$cookies.StyleStoreCart = $scope.items
$scope.Itemcount = $scope.Itemcount + 1
and in my checkout page I am getting the cookies values like this
$scope.items = $cookies.StyleStoreCart;