javascript

apply CSS class on HTML element inside ng-repeat based on condition  #angularjs #reactjs

  • If the answers do not fully address your question, please ask a new question .
  • Stack Overflow works best with JavaScript enabled
  • Browse other questions tagged javascript angularjs or ask your own question .
  • marked as duplicate by Ramesh Rajendran , Louis javascript Users with the javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.
  • On first load, one of the headings appear ‘active` as set.

I am trying to make HTML headings active/inactive based on active variable. But to set the active flag on clicking the heading, I am using the $index variable of ng-repeat directive:

@ng_real_ninja: apply CSS class on HTML element inside ng-repeat based on condition #angularjs #reactjs

directive:

Heading object:

On first load, one of the headings appear ‘active` as set. But on subsequent clicks, it does not give the desired results. All the headings become active on clicking them. Here is the fiddle.

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

javascript