Snowburnt
Snowburnt

Reputation: 6932

angular handler from scope not being called in directive

I have a directive that accepts a root scope defined function as a parameter. It's not working, however. Absolutely nothing is happening.

here's where I call the directive (directivelist.html):

<select-list onsort="onSort" data-set="users" data-columns="columns" sort-by="UserName" reverse="false" selected-item="selection" details="showdetails" selected-index="index"></select-list>

the details is the part I'm having problems with (for some reason onsort is working).

here's the function from link (directive.js):

        scope.detailsHandler=function(item){
          console.log(item);
          scope.details(item);
        };

I know this works because it's being logged. This part isn't (userController.js):

$scope.showdetails=function(user){
      console.log(user);
};

here's the plunkr: http://plnkr.co/edit/N6nkW3e4gDdpQdtRC8ue?p=preview

Upvotes: 0

Views: 140

Answers (1)

bekite
bekite

Reputation: 3444

In your directive.js you overwrite the scope.details function on line 96. Simply remove it and scope.details will get called on the controller.

Upvotes: 1

Related Questions