So my code looks like this
.controller('weinDetailsCtrl', ['$scope', '$stateParams', '$http', '$rootScope',function ($scope, $stateParams, $http, $rootScope) {
$scope.url = "https://winetastic.azurewebsites.net/tables/Wine/" + $rootScope.actWine + "?ZUMO-API-VERSION=2.0.0";
$scope.Winet;
$http({
method: "GET",
url: $scope.url
}).then(function mySucces(response) {
$scope.wineDetails = response.data;
$scope.Winet = $scope.wineDetails.Winetype_ID;
alert($scope.Winet);
}, function myError(response) {
$scope.wineDetails = response.statusText
});
alert($scope.Winet);}])
the first alert gave me the right WineType_ID, the second alert give me an 'Undefined'. What's wrong?
undefineand second will be having value