Expand and collapse with angular js

前端 未结 6 1664
一整个雨季
一整个雨季 2021-01-31 18:53

I am trying to figure out a way to do an expand and collapse using angular js. I haven\'t been able to find an elegant way to do this without manipulating dom objects in the con

6条回答
  •  北荒
    北荒 (楼主)
    2021-01-31 19:06

    The problem comes in by me not knowing how to send a unique identifier with an ng-click to only expand/collapse the right content.

    You can pass $event with ng-click (ng-dblclick, and ng- mouse events), then you can determine which element caused the event:

    do something
    

    Controller:

    $scope.doSomething = function(ev) {
        var element = ev.srcElement ? ev.srcElement : ev.target;
        console.log(element, angular.element(element))
        ...
    }
    

    See also http://angular-ui.github.com/bootstrap/#/accordion

提交回复
热议问题