Reputation: 529
i have one screen.in that i have one toggle button. And from database value 1 0r 2 will come. if 1 i have to swift on the toggle button or else i have to switch off.
how can i do this :
my code :
<label class="item item-input " style="height: 50px;"><span class="input-label"><font style="color:#696969; padding-top: 0px;">Claim</font></span>
<ion-toggle toggle-class="toggle-calm" class="tog" ng-model="data.toggle"></ion-toggle>
</label>
my controller that i tried :
$scope.data = {}
var toggle_value;
var toggleStatus = $scope.data.toggle
if ($scope.singleDetail.ExpClaimReimb == 1) {
toggleStatus == true;
}
else {
toggleStatus == false;
}
From db the value will come here only :
$scope.singleDetail.ExpClaimReimb
please help me out. how can i do this ??
thanks.
Upvotes: 0
Views: 284
Reputation: 1635
Looks like you're probably using an equality check (==) where you should be using assignment (=).
toggleStatus = true; //this, instead of
toggleStatus == true;
Upvotes: 1