2016-09-10 1 views
0

ich den folgenden Code bin mit Bedingung Objekt durch Ruhe api zu bekommen, dieses Objekt haben Betreiber und Antwortfelder, ich brauche sie, wenn die Bedingung Anweisung zu verwenden, in wieErhalten Zustand Betreiber von EL

if(response condition.operator condition.response) 

Zustand. Operator sollte < sein,> oder sonst, So, wie Condition Operator von EL zu bekommen?

Voll Code

Conditions.get({id:id}).$promise.then(function(condition){   
    if(response condition.operator condition.response){ 
    console.log("") 
    } 
}); 

Antwort

0

Versuchen Sie folgendes:

var result; 
if(condition.operator == '<') { 
    result = result < condition.result; 
} else if(condition.operator == '>') 
    result = result > condition.result; 
} else { 
    result = result || condition.result; 
} 

if(result) { 
    console.log(""); 
}