This project was intended to help me testing various functionalities, Travis CI integration and sharing an angular component with Bower.
Easy way : import the directive via Bower
bower install mhicauber/angular-selectable-row-directive --save
Then include the directive.js
file Bower just downloaded into your project.
The directive is intended to be used in conjunction with ng-repeat directive. You must pass in tch-selectable-item, and optionnaly tch-selectable-id attibute with a unique value if used multiple times on the page.
<tr ng-repeat="object in businessObjectsList" tch-selectable-item [tch-selectable-id="id1"] >
<tr ng-repeat="object in businessObjectsList" tch-selectable-item tch-selectable-id="id2" >
...
</tr>
This will render the <tr>..</tr>
items, and tch-selectable-item
directive will bind a click
event on each row dom element.
When a row gets clicked on, the directive adds the row-selected
CSS class.
All you have to do is to customize the class to fit your needs.