2
The question is simple, before the function I declared splited
and within the alternate function splited
for the value returned in response
, now, after the function when I give console.log
returns empty. Because?
var splited;
$scope.id = $routeParams.id;
shows.get($scope.id).then(function(response) {
// splita url video to get only video id
var video = response.video_url;
splited = video.split("=")[1];
});
console.log(splited);
Try to declare the variable in
$rootScope
, I guess that solves your problem– Marcus Vinicius