"找不到不同的支持对象"当我使用ngstyle时

时间:2018-01-19 09:16:30

标签: javascript angularjs angular2-styleguide

我有进度条

the page isnot working ERR_INCOMPLETE_CHUNKED_ENCODING

我使用<div class="progress-bar-line red" role="progressbar" aria-valuenow="redrated" aria-valuemin="0" aria-valuemax="100" ngStyle="max-width:{{redrated}}%" > <span class="title">{{ redrated }}%</span> </div> 并尝试过尝试:

  1. 在组件中创建了一个对象,并在ng风格中调用它
  2. 即使ngStyle="max-width:{{redrated}}%"也提出同样的错误,请帮我解决此问题

1 个答案:

答案 0 :(得分:0)

&#13;
&#13;
    <!DOCTYPE html>
    <html>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
    <body>
    <div ng-app="myApp" ng-controller="myCtrl">    
    <div class="progress-bar-line red" role="progressbar"  
                aria-valuenow="redrated" aria-valuemin="0" aria-valuemax="100"
                ng-style="{'max-width': '{{redrated}}%'}">
                <span class="title">{{ redrated }}%</span>
            </div>
    </div>
    
    <script>
    var app = angular.module('myApp', []);
    app.controller('myCtrl', function($scope) {
        $scope.redrated = 20;
    });
    </script>
    </body>
    </html>
&#13;
&#13;
&#13;