角度js不在值字段

时间:2016-05-27 06:55:06

标签: angularjs

<div ng-init="value = (total_rec - ans_rate)">
        <h4 ng-if="value<0">0</h4>
       <h4 ng-if="value>=0">{{total_rec - ans_rate}}</h4>
  </div>

I want to print 0 if result of total_rec - ans_rate comes 0 or less than 0, here total_rec & ans_rate is variables defined in angular file. please suggest me answers. 

我想在这里实现这个逻辑 离。

var x= total_rec-ans_rate ;
    if (x <=0){
    print 0;
    }else{
    print x;
    }

但是这样: -

 <div ng-init="value = (total_rec - ans_rate)">
            <h4 ng-if="value<0">0</h4>
           <h4 ng-if="value>=0">{{total_rec - ans_rate}}</h4>
      </div>

请建议我这样做的正确方法..谢谢..

1 个答案:

答案 0 :(得分:0)

希望这能让你明白。

if(!isset($_SESSION['UID']) || $_SESSION['UID'] == ''){
    // redirect to index or login page
}

ProjectName