Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.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
Angularjs 基于_Angularjs_Angularjs Directive - Fatal编程技术网

Angularjs 基于

Angularjs 基于,angularjs,angularjs-directive,Angularjs,Angularjs Directive,如果pro_percent的值小于75,我想显示“Complete it” <progressbar class="progress-striped active" max="100" value="user.pro_percent" type="success"> {{user.pro_percent | number:0 }} </progressbar> <span ng-show="user.pro_perce

如果pro_percent的值小于75,我想显示“Complete it”

    <progressbar class="progress-striped active" max="100" value="user.pro_percent" type="success">
            {{user.pro_percent | number:0 }}
    </progressbar>
    <span ng-show="user.pro_percent < 75">Complete it</span>

{{user.pro_percent | number:0}
完成它
我不能动脑去写ng秀的条件。我该怎么走

编辑:

我按照建议添加了这个功能,得到了以下结果

    <div class="progress-striped active progress ng-isolate-scope" max="100" value="user.pro_percent" type="success">
      <div class="progress-bar progress-bar-success" ng-class="type &amp;&amp; 'progress-bar-' + type" role="progressbar" aria-valuenow="73.33" aria-valuemin="0" aria-valuemax="100" ng-style="{width: (percent < 100 ? percent : 100) + '%'}" aria-valuetext="73%" ng-transclude="" style="width: 73.33%;">
        <span class="ng-binding ng-scope">
            73%
        </span>
      </div>
    </div>
    <small ng-show="user.pro_percent < 75" class="ng-hide">Complete it</small>

73%
完成它

我认为这应该很好

<span ng-show="user.pro_percent < 75">Complete it</span>
完成它

如果user.pro\u percent是一个数字,那么应该这样做:

<span ng-show="user.pro_percent < 75">Complete it</span>
完成它

请根据您的建议检查编辑的问题和输出。您在浏览器中看到了什么?没有。它被class=“ng hide”接管,尽管它应该显示为pro_配置文件小于75。现在的值是73.33,如输出所示。您的值(73.33)可能是一个字符串,这就是为什么不能将其与75(一个数字)进行比较的原因。您需要先将73.33转换为浮点值(您可以使用parseFloat),然后将其与75.0进行比较。前端难道没有什么可以做的吗?!数据库中的值为73.33。我无能为力。请根据您的建议检查编辑后的问题和输出。我想知道问题是否是因为值是十进制的?似乎user.pro_percent是一个字符串(73%)。您可以将其存储为数字,并在视图中添加百分比。进度条是否需要%符号?来自后端的数据是73.33,没有%符号。我添加它只是为了进度条。我们不能对字符串而不是数字这样做吗?好的。我终于成功了。非常感谢:)