簡體   English   中英

當我使用ngstyle時出現“找不到其他支持對象”

[英]“Cannot find a differ supporting object” when I am using ngstyle

我有進度條

<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:{{redrated}}%"並嘗試嘗試:

  1. 在組件中創建了一個對象並以ng樣式調用了該對象
  2. 即使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> 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM