how to set bootstrap list-group-item active using angularjs


“How to set bootstrap List-group-item as active listitem using Angularjs”

So recently I was working with Bootstrap’s List-Group and list-group-item in my treeview styled interface. I was looking for how to set particular list-group-item as active item when I click on it.

so basically you have to write ng-click as

ng-click=”$parent.selected = section”

where section is my item in ng-repeat e.g. ng-repeat section in sections.

Now, assign ng-class as below to set active element –

ng-class=”{active:selected == s}”

My plnkr : http://plnkr.co/Dz3klB

That’s it … you are set… Smile 

Happy coding…

Advertisements

One thought on “how to set bootstrap list-group-item active using angularjs

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s