Accessing DOM element siblings using angular js

I have a link function in an directive where i have a toggle functionality to edit the currently active DOM element's css content . How do i access the parent or child class of that DOM element .

A part of the directive :

   link: function(scope, element, attrs) {

        var title = angular.element(element.children()[0]),
            opened = true;

        title.bind('click', toggle);

        function toggle() {
            opened = !opened;
                element.removeClass(opened ? 'closed' : 'opened');                  
                element.addClass(opened ? 'opened' : 'closed');
            element.siblings().removeclass('opened').addclass('closed');  // What to do here  

        }

I would change your link function to this:

link: function(scope, element, attrs) {
    var title = angular.element(element.children()[0]),
        opened = true;

    title.bind('click', toggle);

    function toggle() {
        opened = !opened;
        element.parent().children().addClass("closed");
        element.parent().children().removeClass("opened");
        element.toggleClass("opened", opened);
        element.toggleClass("closed", !opened); //might be redundantdepending on the rest of your code

    }
}

I think you're doing it in the wrong order, if you first remove/add all the classes you need and then modify the element you'll get the result you're after. Simply select the elements parent, and then get all it's parent children. .children() selects only the direct descendents of the parent, while the .find() method which is similar would traverse down the hierarchy. The redundant code might not be necessary depending on if there are other ways to close the element.