jqueryangularjsjqlite

How to add CSS property for firstchild with AngularJS (jqLite)


I want to add css to the first <div> element (firstChild) inside of a <div> with a specific id. How can I achieve this with AngularJS (jqLite).

My HTML looks like this:

<div id="modulare">
   <div class="ibox-content ibox-content">
     ...
   </div>
   <div class="ibox-content ibox-content">
     ...
   </div>
</div>

My AngularJS (does not work even without selection the first child):

if (angular.element('#modulare .ibox-content')){ // I need the first child here
    angular.element('.ibox-content').css("border", "none");
}

Hope you can help.


Solution

  • Try this way:

    if (angular.element('#modulare.ibox-content').first()){ // I need the first child here
        angular.element('#modulare.ibox-content').first().css("border", "none");
    }