I edited my codes
.factory('ProductsService',['$ionicSideMenuDelegate', '$http', 'ApiEndpoint', '$ionicTabsDelegate', '$ionicSlideBoxDelegate', '$stateParams', 'AuthService', function($ionicSideMenuDelegate, $http, ApiEndpoint, $ionicTabsDelegate, $ionicSlideBoxDelegate, $stateParams, AuthService){
var products = [];
var prod = [];
return {
GetProducts: function(){
return $http.get(ApiEndpoint.url + '/products', {}).then(function(response){
products = response.data.products;
return response;
});
},
GetProduct: function(productId){
angular.forEach(products, function(product, key){
$scope.prod = {}; //ERROR: $scope is not defined
if(product.id == productId){
prod = product;
return product;
}
})
return prod;
}
}
}])
..after I click the item that error appears..And the page doesnt show the details must shown..