Set one item of item group as active in angularjs

To set an item among group of items as chosen or active can be done using a directive. The directive needs to know about which group the item belongs to. So, the group name is passed as parameter to the directive.

Live Demo

Usage

Directive parameters:
chosen="groupname"
where, “groupname” is the name of the items group.
namespace="module-name"
where, “module-name” is the name of the namespace the item group is being used in. This is optional parameter, only required when the item group is used multiple times on the same page.

Github repo

Github repo: https://github.com/jsbisht/MarkChosen

Code

The following is the code for the angularjs directive: