I'm using the following code in my Angular app to display an image:
<img ng-src="{{planet.image_url}}" class="planet-img"/>
And I'm using $watch to change the image_url attribute when other events happen. For example:
$scope.$watch('planet', function(planet){
if (planet.name == 'pluto') {
planet.image_url = 'images/pluto.png';
}
});
Using console logs, I see that the model attributes are changing just like I want them to, but these changes are not reflected in the DOM. Why isn't ng-src updating automatically as the model changes? I'm new to Angular, so maybe this is a concept I haven't yet grasped. Any help will be greatly appreciated.