I want an image to be displayed (over the top of another image) upon hovering over it's container. I am trying to get this to work with angular and ng-show however I cannot figure out where I am going wrong. The image with the ng-show attribute is never displayed.
<header class="header">
<a routerLink="/">
<div class="header__link" ng-controller="testCtrl"
ng-init="show = false"
ng-mouseenter="show = true"
ng-mouseleave="show = false">
<img class="header__link--logo" src="assets/img/logo2.jpeg">
<img class="header__link--logo--hover" src="assets/img/logo2hover.jpeg"
ng-show="show">
<h1 class="header__link--title">
INMOCO
</h1>
</div>
</a>
<nav>
</nav>
</header>
var app = angular.module("testApp", []);
console.log("app");
app.controller('testCtrl', function($scope){
$scope.show = false;
});
Please help me understand why the angular specific code is not working or an easier way to do this. Thank you!
Be sure to include the
ng-appdirective:The DEMO