My application checks the state of a lamp and creates an animation in the view.
I am making an ajax request with angular and on the return of success I have to animate a light bulb by following the code:
$scope.checkLuzOk = function (response) {
(response.data.luzSala === '1') ? aninOn($scope.luzSala) : $scope.aninOff($scope.luzSala);
}
I have a luzSala
in the file html
for animation and I'm using $scope.luzSala
as a parameter in the functions aninOn()
and aninOff()
, it follows animation excerpt:
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 altered when I step s