0
My app checks the state of a bulb and creates an animation in the view.
I am making a request ajax with angular and in return for success I have to animate a lamp lighting, follows excerpt from the code:
$scope.checkLuzOk = function (response) {
(response.data.luzSala === '1') ? aninOn($scope.luzSala) : $scope.aninOff($scope.luzSala);
}
have a luzSala
in the archive html
for animation and I’m using the $scope.luzSala
as a parameter in the functions aninOn()
and aninOff()
, follows part of the animation:
var aninOn = function (luz) {
var images = [
"light0.png",
"light10.png",
"light20.png",
"light30.png",
"light40.png",
"light50.png",
"light60.png",
"light70.png",
"light80.png",
"light90.png",
"light100.png"
];
var i = 0;
$interval(function () {
if (i >= images.length) {
i = 0;
}
luz = images[i];
i++;
}, 50, 11);
};
The problem is that the image is not being changed when I pass the
Thank you for the reply Julio.
– Wellington Dias
Thanks for the reply Julio. My html is correct, my problem is in the generic method to animate the image of the lamp. I can even do the animation, but I have 10 lamps to animate and I didn’t want to have to repeat the code of animation 10x.
– Wellington Dias