title: Angular find via attribute
body: <p>I have problem with my script.</p>
  
  <p>js</p>
  
  <pre><code>   $scope.showConfirm = function(e) {
       var confirmPopup = $ionicPopup.confirm({
         title: 'some title',
         template: 'ccccccc'
       });
       confirmPopup.then(function(res) {
         if(res) {
            var a = angular.element(document.querySelectorAll("div['data-id'="+e+"]"));
            console.log(a);
         }
       });
     };
  </code></pre>
  
  <p>and html:</p>
  
  <pre><code>&lt;div class="green" data-id="{{mydiv.mydiv_id}}"&gt;
  &lt;p&gt;some text &lt;/p&gt;
  
      &lt;button class="button button-primary" ng-click="showConfirm({{mydiv.mydiv_id}})"&gt;
        Wykonane
      &lt;/button&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>Everything works well, id is allocated and when I check the console that also is all okay, but at this stage need to click the button changed class.For example when I'm click "showConfirm()" I need change class in div where data-id = showConfirm(id).
  Now my div have class green, when I' click button this class change to red. In jquery the same script view like this:</p>
  
  <pre><code>$(button).on(click, function(e){
   var element = $("div[data-id="+e+"]");
  element.removeClass(green);
  element.addClass(red)
  });
  </code></pre>
  
  <p>How to do it?</p>
  
  <p>EDIT:</p>
  
  <p>I see that I need to add full code to make it clear :)</p>
  
  <p>updated code:</p>
  
  <pre><code>   $scope.showConfirm = function(e) {
       var confirmPopup = $ionicPopup.confirm({
         title: 'title',
         template: 'eeeeee'
       });
       confirmPopup.then(function(res) {
         if(res) {
            var a = angular.element(document.querySelectorAll("div['data-id'="+e+"]"));
            console.log(a);
            $http.get("http://example/rest_api/json?id="+e)
              .success(function(data){
                // if success set green
              })
              .error(function(){
                // if error set red
              })
         }
       });
     };
  </code></pre>
  
  <p>I need change class when my server is success response.</p>