I will use the Data from GET Request in Angular.js, like below.
var app = angular.module('Saidas',[]);
app.controller('Status', function($scope, $http, $interval) {
$interval(function(){
var request = $http.get('/SaidasSite');
request.success(function(data) {
if (data='QTD1LEDON') {
$('#QTD1LAMP').bootstrapToggle('on');
} else (data='QTDLEDOFF'){
$('#QTD1LAMP').bootstrapToggle('off');
} else (data='QTD2LEDON'){
$('#QTD2LAMP').bootstrapToggle('on')
} else { $('#QTD1LAMP').bootstrapToggle('on'); }
})
.error(function(data){
console.log('Error: ' + data);
});
}, 5000);
When i receive "QTD1LEDON", i will toogle a Button in my Code to "ON", when i receive QT1LEDOFF, i will toogle to "OFF". But when i do this code, the comparison always a "QTD1LEDON". What am I doing wrong?
Sorry for my bad english