2

In angularjs ui grid, I have the cell template as shown below :

cellTemplate: " <div class="progress"> <div class="progress-bar progress-bar-info" style="width: 20%"></div> </div>"

Now I need to dynamically set width percentage( style="width: 20%") based on cell value, it could be 30% or 40% or 53%, etc. How can we make it dynamic using row.entity.status? status is my column.

1 Answer 1

1

Angular provide very useful directive called ng-style

ng-style="{width:'{{dynamicValue}}%'}"

In this case

cellTemplate: ' <div class="progress"> <div class="progress-bar progress-bar-info" ng-style="{width:'{{dynamicValue}}%'}"></div> </div>'
Sign up to request clarification or add additional context in comments.

1 Comment

Rishabh, do you have any answer for a similar question with ng-class. Please find my post at stackoverflow.com/questions/40170055/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.