Clicking Text Selects Corresponding Input

    This article is just a quick note for some of the things I have forgotten sadly Html but also give an example using AngularJs.

Basic Html Solution
<input id="1" type="checkbox"/><label for="1">TEST</label>

AngularJs Solution
<input id="{{$index}}" type="checkbox"/><label for="{{$index}}" ng-model="field"></label>

Thoughts
   If I was going to make this more scalable I would need to guarantee that the id is unique. It might become a problem if I'm using multiple ng-repeats then the index would not be so special in the view , maybe I can do the index plus the number for that particular element.

Resources
Clicking the text to select corresponding radio button - Stack Overflow
http://plnkr.co/edit/llSc8o?p=preview

Popular posts from this blog

Nginx Best Practices Extended

Installing Windows on Acer chromebook 15 cb3-532

Entity Framework: ToListAynsc & WhereAsync