Why am I not able to assign value to $rootScope with the following code.
fetchIp().then(function(response){
$rootScope.nodeIp = (response.length == 0 ? "localhost" : response[0]);
});
var root = 'http://' + $rootScope.nodeIp + ':8080/';
It shows it as 'undefined'