onclick - AngularJS Reactive Images (ng-class) -


i have 3 variations of 1 image. need swap image based on event state example: 'current' 'onclick' 'onhover'. want use standard windows events. can use angular's 'ng-class' images , add in onclick & oncover javascript test expression? precisely testing event listener ?!

for example:

this requirement customer. possible angularjs.

there's short worthy blog post issue here.

it suggests using strategy similar following mouseover/hover events...

<div id="divid" ng-init="imgsrc='/images/twitter_blue.png'" ng-mouseover="imgsrc='/images/twitter_brown.png'" ng-mouseout="imgsrc='/images/twitter_blue.png'">     <img ng-src="{{imgsrc}}"/>     <div>image description</div> </div> 

additionally, use ng-click manage changes in ng-src click events

<div id="divid" ng-click="updateimagesrc()" ... 

Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -