1

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!

1 Answer 1

2

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/

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for quick reply!

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.