Question: can someone please give me an idea on how will i set focus on my textbox when I click the radiobutton assigned to it? Im using angular js. Thanks for any idea

Answer: 
I created [example](http://plnkr.co/edit/rpKlwheIJ4GFf07Fnpc2?p=preview) for you.

**HTML:**

```
<body ng-app="scopeExample">
  <div ng-controller="MyController">
    <div ng-repeat='item in mas'>
      <input type="radio" name='somename' ng-model="item.select" value="true" ng-click='clear(item)'>
      <input type='text' focus='item.select'/>
      <br>
    </div>
  </div>
</body>

```

**Javascript:**

```
angular.module('scopeExample', [])
  .controller('MyController', ['$scope', function($scope) {

    $scope.mas=[
      {id:1,select:false},
      {id:2,select:false},
      {id:3,select:false},
      {id:4,select:false}
      ];

  $scope.clear = function(item){
    $scope.mas.forEach(function(x){
      if(x != item)
        x.select=false;
    });
  }

  }]).directive('focus',['$timeout', '$parse', function($timeout, $parse){

    return {
      link:function (scope, element, attrs) {
            var model = $parse(attrs['focus']);
            scope.$watch(model, function (value) {                
                if (eval(value)) 
                    $timeout(function () {
                        element[0].focus();
                    });                
            });
    }
  }

  }]);

```
I will provide you pseudo code which you can alter on the basis of your needs. For now, the code has one radio button which when selected will focus on the input element. However, you can achieve those on list, on checkbox as per your need.

HTML:

```
<div ng-controller="MyCtrl">
    <input type="radio" ng-model="focusRadio" value=0>
    <input ng-model="name" focus>
</div>

```

Script:

```
var myApp = angular.module('myApp',[]);

myApp.directive('focus', function() {
    return function(scope, element) {
       scope.$watch('focusRadio', 
         function (newValue) { 
            newValue && element[0].focus()
         })
    }      
});

function MyCtrl($scope) {}

```

Here is the plunker: <http://plnkr.co/edit/ABHCRIm95EyNUI8nWczh?p=preview> . Change the input type to checkbox to better know about the functionality.