Warum wird ng-wenn nicht validieren die Funktion, die ich es als wahr oder falsch übergeben? Das div-Element wird nicht angezeigt, auch wenn die Bedingung erfüllt ist.ng-wenn Funktion nicht validiert
controller.js
$scope.getCategoriseScore = function(profile) {
var currentRating = this.profile.currentRating;
if(currentRating >= 961 && currentRating <= 999) {
var scoreRange = "excellent";
return scoreRange;
} else if(currentRating >= 881 && currentRating <= 960) {
var scoreRange = "good";
return scoreRange;
} else if(currentRating >= 721 && currentRating <= 880) {
var scoreRange = "fair";
return scoreRange;
} else if(currentRating >= 561 && currentRating <= 720) {
var scoreRange = "poor";
return scoreRange;
} else if(currentRating >= 0 && currentRating <= 560) {
var scoreRange = "very poor";
return scoreRange;
}
}
view.html
<div class="row" ng-if="getCategoriseScore() <= 961">
</div>
'getCategoriseScore()' gibt die Zeichenfolge. Und du vergleichst es mit der Anzahl in Sicht. – Tushar