我确实有一个进度条
<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>
我已经使用了 ngStyle="max-width:{{rederated}}%"
并尝试了尝试:
- 在组件中创建了一个对象并以 ng 风格调用它
- 即使
ngStyle="{'max-width': '20px' }"
也给出了相同的错误,请帮我解决这个问题
最佳答案
<!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>
关于javascript - 当我使用 ngstyle 时为 "Cannot find a differ supporting object",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48337649/