javascript - AngularJS - How do I bind click functions to child elements -


i'd bind click functions these list items in angular directive, have no idea how this... element links whole div, how create click listener these list items... ?

    app.directive('paginalijst', function() {     return {     templateurl: 'js/templates/paginas.html',     restrict: 'ae',     replace: true,     link: function( $scope, element, attrs) {          element.bind('mouseenter', function () {             element.css('background-color', 'yellow');         });         element.bind('mouseleave', function () {             element.css('background-color', 'white');         });     } }; }); 

and template

<div ng-class="colsizelist" class="beheer a-show-hide" id="opdrachten" ng-hide="opdactive">  <h4>beheer opdrachten</h4>  <ul class="list-group"> <li class='list-group-item  opdracht' ng-class="{ 'active': $index == selectedindex }" ng-repeat="opdracht in opdrachten">         <a href="#">                 <span>{{opdracht.vak}}</span>                 <small>{{opdracht.titel}}</small>         </a> </li> </ul> </div> 

change selector:

element.find('li').bind(...) 

.find() jqlite method limited tagname lookup so, have put target element tagname.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -