angularjs ng-click获取当前元素

<div>
    <input id="dd" type="text" class="form-control"
           ng-click="showMenu($event)" ng-model="dept.name" readonly>

    <div class="treeview-back"
         style="display:none; position: absolute; z-index: 10000; max-height: 230px;background-color: #ffffff;">
        <ul id="deptTree" class="ztree" style="margin-top:0; width:260px;"></ul>
    </div>
</div>
scope.showMenu = function (event) {
    console.log($(event.target).attr('id'));                                        $(event.target).next().css({left:15+'px', top:34+'px',display: "block"}).slideDown("fast");                                                                 
}

在方法中传入$event,js中通过event.target获取当前元素。

你可能感兴趣的:(AngularJS)