How do you rotate image in angularjs

前端 未结 3 928
[愿得一人]
[愿得一人] 2021-01-03 03:36

Hi I have an image that I want to rotate. There are two buttons left and right which rotate the image 45 degrees in opposite directions. I tried creating a directive using

3条回答
  •  走了就别回头了
    2021-01-03 04:07

    $scope.RotateImageRight = function () {
                z = z + 1;
                var img;
                if (z === 1) {
                    img = document.getElementById("rotate90");
                    img.style.transform = "rotate(-90deg)";
                    img.style.width = "725px";
    
                }
    
                else if (z === 2) {
                    img = document.getElementById("rotate90");
                    img.style.transform = "rotate(-180deg)";
                    img.style.width = "870px";
                }
    
                else if (z === 3) {
                    img = document.getElementById("rotate90");
                    img.style.transform = "rotate(-270deg)";
                    img.style.width = "725px";
                }
    
                else if (z === 4) {
                    img = document.getElementById("rotate90");
                    img.style.transform = "rotate(-360deg)";
                    img.style.width = "870px";
                } else {
                    z = 0;
                }
    
            }
    

提交回复
热议问题