I have an angular controller, in which i have a function that should return an image depends on the json that is received from the server. The problem is that it does not matter which country is received it load only the first one (usa.png in my case).
$scope.getUser = function(){
url = "/get";
$scope.img = "";
$http.post(url, {
"Id":$scope.Id,
"name":$scope.name
}).then(
function (response){
$scope.returnedUser = response.data;
if ($scope.returnedUser.country = "USA"){
$scope.img = "/base_icons/usa.png";
} else if ($scope.returnedUser.country = "Canada"){
$scope.img = "/base_icons/canada.png";
} else if ($scope.returnedUser.country = "Mexico"){
$scope.img = "/base_icons/mexico.png";
}
}, $scope.negativeMessage);};
<img ng-src="{{img}}"/>