Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何根据db[ionic]的输入值打开/关闭切换按钮_Javascript_Html_Cordova_Ionic Framework_Hybrid Mobile App - Fatal编程技术网

Javascript 如何根据db[ionic]的输入值打开/关闭切换按钮

Javascript 如何根据db[ionic]的输入值打开/关闭切换按钮,javascript,html,cordova,ionic-framework,hybrid-mobile-app,Javascript,Html,Cordova,Ionic Framework,Hybrid Mobile App,我有一个屏幕,其中我有一个切换按钮。从数据库值10r2将得到。如果我必须快速打开切换按钮,否则我必须关闭 我如何做到这一点: 我的代码: <label class="item item-input " style="height: 50px;"><span class="input-label"><font style="color:#696969; padding-top: 0px;">Claim</font></span>

我有一个屏幕,其中我有一个切换按钮。从数据库值10r2将得到。如果我必须快速打开切换按钮,否则我必须关闭

我如何做到这一点:

我的代码:

<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>
db中的值将仅出现在此处:

$scope.singleDetail.expclaimrimb

请帮帮我。我该怎么做


谢谢。

看起来您可能正在使用相等检查(=),而您应该使用赋值(=)

$scope.data = {}  
 var toggle_value;
  var toggleStatus = $scope.data.toggle 
if ($scope.singleDetail.ExpClaimReimb == 1) {

toggleStatus == true;


}
else {

  toggleStatus == false;

}
toggleStatus = true; //this, instead of
toggleStatus == true;