图片旋转基于 CSS:transform:rotate(**deg)
实现,Angular 用于动态绑定 deg 数:
controller:(其实可以省略)
lang:js
$scope.img = {src:"xxx.png", rotate=0};
HTML:
lang:html
<button ng-click="img.rotate=img.rotate+90">向右转</button>
<button ng-click="img.rotate=img.rotate-90">向左转</button>
<img ng-src="img.src" style="transform:rotate({{img.rotate}}deg);">