angularjs - Anular js Using with controllers how to change my div as replaced as another div on mouse over on a button? -
anular js using controllers how change div replaced div on mouse on over button ?
you can use ng-if or ng-show or ng-hide combined events directives ng-mouseover or ng-mouseenter , ng-mouseleave
function supercontroller($scope) { $scope.hovered = false; } angular.module('myapp', []); angular .module('myapp') .controller('supercontroller', supercontroller)
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script> <div ng-app="myapp"> <div ng-controller="supercontroller s"> <button ng-mouseover="hovered=true" ng-mouseleave="hovered=false">hover me</button> <div ng-if="hovered">shown if hovered</div> <div ng-if="!hovered">shown if not hovered</div> </div> </div>
Comments
Post a Comment