从元素属性调用函数时出错

时间:2014-05-20 10:54:11

标签: angularjs angularjs-directive angularjs-scope angularjs-ng-repeat

尝试使用动态值创建多个进度条

<progressbar class="progress-striped active"  value="{{getValue(value.currentStatus)}}"
  type="{{getType(this.value, value.currentStatus)}}">
    {{ value.currentStatus }}
</progressbar>

以下两个函数被调用,但getType函数被调用并正常工作  但getValue函数不会被称为抛出错误

  

错误:[$ parse:syntax]语法错误:令牌'getValue'是意外的,   期待[:]在表达式的第3列   [{{getValue(value.currentStatus)}}]从   [的getValue(value.currentStatus)}}]

$scope.getValue = function(Status) {

        var tasksLength = 4;
        var completedActions;

        if (Status != null) {
             completedActions = completedActions + 1;
        }

        var progressActions = (completedActions == tasksLength) ? 0 : 1;

        var queuedActions = tasksLength - (completedActions + progressActions);

        return Math.ceil(((queuedActions * 0.09) + (progressActions * 0.35) +
                    completedActions) / tasksLength * 100);
    }

    $scope.getType = function(value, Status) {

        if ((value > 80) && (Status == "FAILED")) {
            type = 'danger';
        } else if (value > 80) {
            type = 'success';
        } else if (value > 50) {
            type = 'warning';
        } else {
            type = 'info';
        }
        return type;
    }

请帮我解决这个错误

0 个答案:

没有答案