Reputation: 157
I am trying to bind the css counter-reset
property dynamically in AngularJS. Here is fiddle link where you can see what I am trying.
Basically I want the numbering of li
elements should start with the number set in the controller. I tried using ng-style
and ng-bind-html
to directly bind the style string but still it is not showing the correct output, numbering always starts from 1.
Any help is appreciated! Thanks!
Upvotes: 1
Views: 126
Reputation: 1529
Pretty simple. ng-style
expects an expression which evals to an object whose keys are CSS style names and values are corresponding values for those CSS keys.
Change your code to be: <ul ng-style="{'counter-reset': myHtml}">
and you're good to go.
Example here: https://jsfiddle.net/dboskovic/4cgexgoc/2/
Upvotes: 2