title: Unable to add attributes from the controller in angular js ionic
body: <p>I am using angularjs. I am trying to search and navigate to the user on click.On search, I am creating html from the angularjs controller and display in the view. </p>
  
  <p>But the strange thing is, in html I can add attribute class, but not id or ng-click. I just want to add ng-click in the html so that I can perform action on click too. On click I want to navigate to the particular user profile.</p>
  
  <p>Here is my Code, Please review it and suggest me where I am wrong.</p>
  
  <pre><code>    .controller('searchDesignCtrl', function($scope,$http,api_root) {
      $scope.html = '&lt;div class="button-bar"&gt;&lt;a class="search-item"&gt;&lt;i class="ion-person"&gt;&lt;/i&gt;Username&lt;/a&gt;&lt;a class="search-item"&gt;&lt;i class="ion-person"&gt;&lt;/i&gt;Username&lt;/a&gt;&lt;a class="search-item"&gt;&lt;i class="ion-person"&gt;&lt;/i&gt;Username&lt;/a&gt;&lt;a class="search-item"&gt;&lt;i class="ion-person"&gt;&lt;/i&gt;Username&lt;/a&gt;&lt;a class="search-item"&gt;&lt;i class="ion-person"&gt;&lt;/i&gt;Username&lt;/a&gt;&lt;a class="search-item"&gt;&lt;i class="ion-person"&gt;&lt;/i&gt;Username&lt;/a&gt;&lt;/div&gt;'
      $scope.searchuser = function(element){
          $scope.value_input = $(element.currentTarget).val();
          var link = api_root+'users/search_users';
          $http({
              url: link,
              method: "POST",
              data: 'uname=' + $scope.value_input,
              headers: {'Content-Type': 'application/x-www-form-urlencoded'}
              }).success(function (data, status, headers, config) {
                  $scope.fetched_users = data.data;
                  $scope.html ='&lt;div class="button-bar"&gt;';
                  $.each($scope.fetched_users, function(key,value){
                      //here ng-click is not added in the view
                      $scope.html+= '&lt;a class="search-item '+value.User.id+'" ng-click="navigate_to_user()"&gt;&lt;i class="ion-person"&gt;&lt;/i&gt;'+value.User.username+'&lt;/a&gt;'; 
                  });
                  $scope.html +='&lt;/div&gt;';
  //                console.log($scope.html);
              }).error(function (data, status, headers, config) {});
      }
      $scope.navigate_to_user=function(){
          console.log($scope);
      }
  })
  </code></pre>