angularjs - ng-click not firing from anchor tag using directive -


i've written directive return ul 1 list item along function action should fire. action not fire, , see no error in log. here's code:

    localizer_module.directive('utilitymenu', function(){      return {         scope: {             action: '&'           },         restrict: 'e',         replace: true,         template:         "<ul ><li style='font-size:12px; color:#fff;'><a href ng-click='action()'>hello, world</a></li></ul>",      };  });  localizer_module.writelog = function(){      console.log("called!"); }; 

if add onclick="alert('fired')", alert. doing wrong directive? thanks

i don't have enough here you. need plunker or can figure out why isn't working. here's things check though:

make sure parent scope contains directive has function assigned calling via action attribute.

so if you're doing this:

<utility-menu action="submit()"></utility-menu> 

than controller needs have this:

function myctrl($scope) {   $scope.submit = function() {      alert('yes');   } } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -