fix the value of completed percent is wrong

This commit is contained in:
MaysWind 2016-05-17 21:52:59 +08:00
parent 32e9959d0d
commit caf1fda198
3 changed files with 14 additions and 1 deletions

View file

@ -190,6 +190,7 @@
<script src="scripts/controllers/main.js"></script> <script src="scripts/controllers/main.js"></script>
<script src="scripts/controllers/settings-ariang.js"></script> <script src="scripts/controllers/settings-ariang.js"></script>
<script src="scripts/filters/dateDuration.js"></script> <script src="scripts/filters/dateDuration.js"></script>
<script src="scripts/filters/percent.js"></script>
<script src="scripts/filters/substring.js"></script> <script src="scripts/filters/substring.js"></script>
<script src="scripts/filters/taskOrderBy.js"></script> <script src="scripts/filters/taskOrderBy.js"></script>
<script src="scripts/filters/volumn.js"></script> <script src="scripts/filters/volumn.js"></script>

View file

@ -0,0 +1,12 @@
(function () {
'use strict';
angular.module("ariaNg").filter('percent', ['numberFilter', function (numberFilter) {
return function (value, precision) {
var ratio = Math.pow(10, precision);
var result = parseInt(value * ratio) / ratio;
return numberFilter(result, precision);
}
}]);
})();

View file

@ -11,7 +11,7 @@
aria-valuenow="{{task.completePercent}}" aria-valuemin="1" aria-valuenow="{{task.completePercent}}" aria-valuemin="1"
aria-valuemax="100" style="width: {{task.completePercent}}%;"> aria-valuemax="100" style="width: {{task.completePercent}}%;">
<div ng-class="{'lower': task.completePercent < 50}" <div ng-class="{'lower': task.completePercent < 50}"
ng-bind="(task.completePercent | number: 2) + '%'"></div> ng-bind="(task.completePercent | percent: 2) + '%'"></div>
</div> </div>
</div> </div>
<div> <div>