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.
where, “groupname” is the name of the items group.
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: https://github.com/jsbisht/MarkChosen
The following is the code for the angularjs directive: