admin管理员组文章数量:1419220
I want to use UI bootstrap progressbar inside a table to give a visual representation of some statistics. The stats are percentages so it should work quite nicely, i.e. the higher the percentage the longer the bar.
I need to calculate the value with an expression, so I'm creating the progressbar element like so inside the table column:
<uib-progressbar type="info" value="{{ ((statValue / total) * 100) }}"></uib-progressbar>
Just to clarify, that's a simplified example, but the point is I cannot get any kind of expression to work when trying to calculate the value attribute.
It works if I give the attribute a different name and it works if I create a "value" attribute on any other type of element (e.g. a div). It just does not seem to work for the value attribute on the uib-progressbar element, which is exactly where I need it!
The error I get in the browser console is:
"Error: [$parse:syntax] Syntax Error: Token '{' invalid key at column 2 of the expression [{{ ((statValue / total) * 100) }}] starting at [{ ((statValue / total) * 100) }}]."
I'm using angularjs 1.4.9 and angular-ui-bootstrap 1.1.2.
How do I get this to work?
I want to use UI bootstrap progressbar inside a table to give a visual representation of some statistics. The stats are percentages so it should work quite nicely, i.e. the higher the percentage the longer the bar.
I need to calculate the value with an expression, so I'm creating the progressbar element like so inside the table column:
<uib-progressbar type="info" value="{{ ((statValue / total) * 100) }}"></uib-progressbar>
Just to clarify, that's a simplified example, but the point is I cannot get any kind of expression to work when trying to calculate the value attribute.
It works if I give the attribute a different name and it works if I create a "value" attribute on any other type of element (e.g. a div). It just does not seem to work for the value attribute on the uib-progressbar element, which is exactly where I need it!
The error I get in the browser console is:
"Error: [$parse:syntax] Syntax Error: Token '{' invalid key at column 2 of the expression [{{ ((statValue / total) * 100) }}] starting at [{ ((statValue / total) * 100) }}]."
I'm using angularjs 1.4.9 and angular-ui-bootstrap 1.1.2.
How do I get this to work?
Share Improve this question edited Aug 11, 2016 at 8:05 Pankaj Parkar 136k23 gold badges240 silver badges303 bronze badges asked Feb 14, 2016 at 9:13 ctrlzctrlz 951 silver badge9 bronze badges1 Answer
Reset to default 4value
attribute should not be using interpolation {{}}
inside value attribute, you could directly get scope variable values in it, like other directive of angular does ng-click
, ng-if
, etc.
<uib-progressbar type="info" value="((statValue / total) * 100)"></uib-progressbar>
Sample Here
本文标签:
版权声明:本文标题:javascript - Angular UI Bootstrap progress bar - how to calculate "value" attribute with expression? - Stack O 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745302656a2652466.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论